piler/init.d/rc.piler.in

66 lines
1.0 KiB
Plaintext
Raw Normal View History

2012-02-14 20:16:05 +01:00
#!/bin/sh
##
##
2013-12-14 11:10:16 +01:00
### BEGIN INIT INFO
# Provides: piler
# 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: piler email archiver
# Description: piler email archiver
### END INIT INFO
2012-02-14 20:16:05 +01:00
NAME=piler
PID_FILE=`SBINDIR/pilerconf -q pidfile | cut -f2 -d=`
PID_NUMBER=`test -f ${PID_FILE} && cat ${PID_FILE}`
start() {
2013-04-09 16:10:08 +02:00
echo "starting $NAME . . ."
2012-02-14 20:16:05 +01:00
SBINDIR/piler -d
}
stop() {
2013-04-09 16:10:08 +02:00
echo "stopping $NAME"
2012-07-06 15:18:08 +02:00
kill ${PID_NUMBER}
2012-02-14 20:16:05 +01:00
}
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
;;
2012-02-14 20:16:05 +01:00
*)
echo "Usage: $0 start|stop|restart|reload|status"
2012-02-14 20:16:05 +01:00
esac