piler/init.d/rc.pilergetd.in
2013-12-14 11:10:16 +01:00

65 lines
1.1 KiB
Bash

#!/bin/sh
##
##
### BEGIN INIT INFO
# Provides: pilergetd
# Required-Start: $remote_fs $syslog $named $network $time mysql
# Required-Stop: $remote_fs $syslog $named $network mysql
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: pilergetd daemon
# Description: pilergetd daemon for remote access
### END INIT INFO
NAME=pilergetd
PID_FILE=`SBINDIR/pilerconf -q pilergetd_pidfile | cut -f2 -d=`
PID_NUMBER=`test -f ${PID_FILE} && cat ${PID_FILE}`
start() {
echo "starting $NAME . . ."
SBINDIR/pilergetd -d
}
stop() {
echo "stopping $NAME"
kill ${PID_NUMBER}
}
check_status(){
test -f /proc/${PID_NUMBER}/status
}
case "$1" in
start)
start;
;;
stop)
stop;
;;
status)
if check_status;
then
echo "${NAME} is running."
else
echo "${NAME} is not running."
fi
;;
restart)
stop;
sleep 1;
start;
;;
reload)
kill -HUP $PID_NUMBER
;;
*)
echo "Usage: $0 start|stop|restart|reload|status"
esac