Port to use CentOS init.d functions
Posted
by
jcalfee314
on Server Fault
See other posts from Server Fault
or by jcalfee314
Published on 2012-10-22T18:59:14Z
Indexed on
2012/10/22
23:04 UTC
Read the original article
Hit count: 227
centos
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?
© Server Fault or respective owner