1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
|
#!/bin/sh
#
# start/stop elida daemon.
### BEGIN INIT INFO
# Provides: elida
# Required-Start: $network
# Required-Stop: $network
# Should-Start: $named
# Should-Stop: $named
# Default-Start: S 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: pbuilder mail interface
# Description: elida accepts commands from email messages from
# a user to build debian packages by running
# pbuilder. It then runs piuparts, lintian and
# the reports are compressed an emailed back to
# the user.
### END INIT INFO
test -f /usr/sbin/elidad || exit 0
. /lib/lsb/init-functions
if [ -f /etc/elida/elida.conf ]
then
. /etc/elida/elida.conf
else
log_begin_msg "/etc/elida/elida.conf does not exist"
log_end_msg 0
exit 0
fi
if [ -z "$ELIDAHOME" ]
then
log_begin_msg "variable ELIDAHOME is not defined"
log_end_msg 0
exit 0
fi
if [ ! -d $ELIDAHOME ]
then
log_begin_msg "directory $ELIDAHOME does not exist"
log_end_msg 0
exit 0
fi
case "$1" in
start)
test -f $ELIDAHOME/elida-stop && rm -f $ELIDAHOME/elida-stop
log_begin_msg "Starting elida daemon..."
pid=$(pidof elidad)
if [ -n "$pid" ]
then
log_begin_msg "Already running."
log_end_msg 0
exit 0
fi
if [ -n "$(ps waux | grep /usr/sbin/elidad$)" ]
then
log_begin_msg "Already running."
log_end_msg 0
exit 0
fi
start-stop-daemon --start --quiet --oknodo --exec /usr/bin/setsid -- /usr/sbin/elidad &
log_end_msg $?
;;
stop)
log_begin_msg "Stopping elida daemon..."
touch $ELIDAHOME/elida-stop
start-stop-daemon --stop --quiet --oknodo --exec /usr/sbin/elidad
log_end_msg $?
;;
force-reload)
$0 restart
;;
restart)
$0 stop
sleep 11
$0 start
;;
*)
log_success_msg "Usage: /etc/init.d/elida {start|stop|force-reload|restart}"
exit 1
;;
esac
exit 0
|