Rev 47 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
#!/bin/sh
#
### BEGIN INIT INFO
# Provides: prayer
# Required-Start:
# Required-Stop:
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Prayer init script
# Description: Init script for prayer services
### END INIT INFO
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
FRONTEND_DAEMON=/usr/sbin/prayer
SESSION_DAEMON=/usr/sbin/prayer-session
FRONTEND_PIDFILE=/var/run/prayer/prayer.pid
SESSION_PIDFILE=/var/run/prayer/prayer-session.pid
DESC="webmail server"
test -x $DAEMON || exit 0
. /lib/lsb/init-functions
ENABLED=0
# Include prayer defaults if available
if [ -f /etc/default/prayer ] ; then
. /etc/default/prayer
fi
set +e
start() {
if [ "$ENABLED" = "0" ]; then
echo "Prayer is disabled. Please set ENABLED=1 in /etc/default/prayer"
echo "after adapting /etc/prayer/prayer.cf to your needs."
exit 0
fi
log_daemon_msg "Starting $DESC" "prayer"
start-stop-daemon --start --pidfile $FRONTEND_PIDFILE \
--exec $FRONTEND_DAEMON -- $DAEMON_OPTS
log_end_msg $?
}
stop() {
log_daemon_msg "Stopping $DESC"
if [ -f "$SESSION_PIDFILE" ]; then
start-stop-daemon --stop --quiet --oknodo --pidfile $SESSION_PIDFILE
log_progress_msg "prayer-session"
fi
if [ -f "$FRONTEND_PIDFILE" ]; then
start-stop-daemon --stop --quiet --oknodo --pidfile $FRONTEND_PIDFILE
start-stop-daemon --stop --quiet --oknodo --exec $FRONTEND_DAEMON
log_progress_msg "prayer"
fi
rm -f "$FRONTEND_PIDFILE" "$SESSION_PIDFILE"
log_end_msg 0
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|force-reload)
#
# If the "reload" option is implemented, move the "force-reload"
# option to the "reload" entry above. If not, "force-reload" is
# just the same as "restart".
#
stop
start
;;
*)
N=/etc/init.d/prayer
# echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
log_failure_msg "Usage: $N {start|stop|restart|force-reload}" >&2
exit 1
;;
esac
exit 0