Port to use CentOS init.d functions
- by jcalfee314
What are good equivalent centos commands using functions in /etc/init.d/functions such as daemon to perform the following tasks?
STARTCMD='start-stop-daemon --start --exec /usr/sbin/swapspace --quiet --pidfile /var/run/swapspace.pid -- -d -p'
STOPCMD='start-stop-daemon --stop --oknodo --quiet --pidfile /var/run/swapspace.pid'
It looks like daemon will work for the start command and killproc is used for the stop command.
. /etc/init.d/functions
pushd /usr/sbin
daemon --pidfile /var/run/swapspace.pid /usr/sbin/swapspace
. /etc/init.d/functions
killproc -p $(cat /var/run/swapspace.pid)
Would the --oknodo be needed in the CentOS env (the swap file is really only boot-time)? "oknodo - Return exit status 0 instead of 1 if no actions are (would be) taken."
I don't see quiet in daemon or killproc, I can't imagine that it would matter though.
The original start-stop-daemon for swapspace seems to have both -p and --pidfile (the same command). That must be an error.
Did I miss anything? Any idea why daemon not create the pid file?