4 # Required-Start: $remote_fs $syslog
5 # Required-Stop: $remote_fs $syslog
6 # Default-Start: 2 3 4 5
8 # Short-Description: control citadel server start at boot time
9 # Description: control citadel server start at boot time
12 # uncomment this to create coredumps as described in
13 # http://www.citadel.org/doku.php/faq:mastering_your_os:gdb#how.do.i.make.my.system.produce.core-files
16 # Author: Wilfried Goesgens <citadel@outgesourced.org>
18 RUNDIR=/var/run/citadel
19 PATH=/sbin:/usr/sbin:/bin:/usr/bin
20 DESC="Citadel Groupware "
22 DAEMON=/usr/sbin/$NAME
23 PIDFILE=$RUNDIR/citadel.pid
24 DAEMON_ARGS=" -d -lmail -t/dev/null"
25 SCRIPTNAME=/etc/init.d/citadel
26 SENDCOMMAND=/usr/sbin/sendcommand
28 # Exit if the package is not installed
29 [ -x "$DAEMON" ] || { echo "$DAEMON not installed"; exit 1; }
31 # Read configuration variable file if it is present
32 [ -r /etc/default/$NAME ] && . /etc/default/$NAME
36 # Load the VERBOSE setting and other rcS variables
37 if test -f /lib/init/vars.sh ; then
41 # Define LSB log_* functions.
42 # Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
43 if test -f /lib/lsb/init-functions; then
44 . /lib/lsb/init-functions
49 # Function that starts the daemon/service
53 # check our volatile dirs.
54 if test ! -d $RUNDIR; then
59 # 0 if daemon has been started
60 # 1 if daemon was already running
61 # 2 if daemon could not be started
71 # Function that stops the daemon/service
75 if test -S $RUNDIR/citadel.socket; then
76 sendcommand "DOWN" || :
79 PID=`cat $PIDFILE 2>/dev/null || :`
80 if [ ! -z $PID ]; then
83 while test -S /var/run/citadel/citadel.socket -o -d /proc/$PID; do
87 if test "$count" = "10"; then
90 if test "$count" = "20"; then
92 rm -rf /var/run/citadel/*
102 # Function that sends a SIGHUP to the daemon/service
106 # 0 if daemon could not be restarted
107 # 1 if daemon has been restarted
108 # other if a failure occurred
109 if $SENDCOMMAND "DOWN 1" 2>&1|grep '200 Restarting'>/dev/null ; then
117 if test -n "$MODERN"; then
118 [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
120 echo "Starting $DESC" "$NAME"
124 if test -n "$MODERN"; then
126 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
127 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
132 if test -n "$MODERN"; then
133 [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
135 echo "Stopping $DESC" "$NAME"
138 if test -n "$MODERN"; then
139 [ "$VERBOSE" != no ] && log_end_msg 0
147 if test -n "$MODERN"; then
148 log_daemon_msg "Restarting $DESC" "$NAME"
150 echo "Restarting $DESC" "$NAME"
155 if test -n "$MODERN"; then
169 status_of_proc "$DAEMON" $NAME
173 echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2