We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
我试了2种开机方式都不行,文件在/root/cns下
[Unit] Description=CNS Service After=network.target
[Service] Type=simple ExecStart=/root/cns/cns -daemon Restart=always User=root
[Install] WantedBy=multi-user.target
#!/bin/sh
. /etc/rc.d/init.d/functions
prog=cns lockfile=/var/lock/subsys/$prog pidfile=/var/run/$prog.pid configfile=/root/cns/config.cfg start() { echo -n $"Starting $prog: " daemon --pidfile=$pidfile --user=root --check $prog $prog -f $configfile & RETVAL=$? [ $RETVAL -eq 0 ] && touch $lockfile echo return $RETVAL }
stop() { echo -n $"Stopping $prog: " killproc -p $pidfile $prog RETVAL=$? [ $RETVAL -eq 0 ] && rm -f $lockfile $pidfile echo return $RETVAL }
restart() { stop start }
case "$1" in start) start ;; stop) stop ;; restart) restart ;; *) echo $"Usage: $prog {start|stop|restart}" exit 1 esac
exit $RETVAL
The text was updated successfully, but these errors were encountered:
使用systemctl enable cns就行 程序安装的时候添加了自启程序
Sorry, something went wrong.
No branches or pull requests
我试了2种开机方式都不行,文件在/root/cns下
[Unit]
Description=CNS Service
After=network.target
[Service]
Type=simple
ExecStart=/root/cns/cns -daemon
Restart=always
User=root
[Install]
WantedBy=multi-user.target
#!/bin/sh
chkconfig: 345 99 10
description: cns daemon
processname: cns
pidfile: /var/run/cns.pid
configfile: /root/cns/config.cfg
Source function library.
. /etc/rc.d/init.d/functions
prog=cns
lockfile=/var/lock/subsys/$prog
pidfile=/var/run/$prog.pid
configfile=/root/cns/config.cfg
start() {
echo -n $"Starting $prog: "
daemon --pidfile=$pidfile --user=root --check $prog
$prog -f $configfile &
RETVAL=$?
[ $RETVAL -eq 0 ] && touch $lockfile
echo
return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
killproc -p $pidfile $prog
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f $lockfile $pidfile
echo
return $RETVAL
}
restart() {
stop
start
}
See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
*)
echo $"Usage: $prog {start|stop|restart}"
exit 1
esac
exit $RETVAL
The text was updated successfully, but these errors were encountered: