4 # Required-Start: $local_fs $remote_fs
5 # Required-Stop: $local_fs $remote_fs
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 -x3 -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" ] || exit 0
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 # for ubuntu: check our volatile dirs.
54 if test ! -d $RUNDIR; then
58 # 0 if daemon has been started
59 # 1 if daemon was already running
60 # 2 if daemon could not be started
70 # Function that stops the daemon/service
75 # 0 if daemon has been stopped
76 # 1 if daemon was already stopped
77 # 2 if daemon could not be stopped
78 # other if a failure occurred
79 if $SENDCOMMAND "DOWN" >/dev/null 2>&1 ; then
80 if test ! -f "$PIDFILE"; then
81 echo Unable to find Citserver. Not running?
87 while test -S /var/run/citadel/citadel.socket -o -d /proc/$PID; do
91 if test "$count" = "10"; then
94 if test "$count" = "20"; then
96 rm -rf /var/run/citadel/*
107 # Function that sends a SIGHUP to the daemon/service
111 # 0 if daemon could not be restarted
112 # 1 if daemon has been restarted
113 # other if a failure occurred
114 if $SENDCOMMAND "DOWN 1" 2>&1|grep '200 Restarting'>/dev/null ; then
122 if test -n "$MODERN"; then
123 [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
125 echo "Starting $DESC" "$NAME"
129 if test -n "$MODERN"; then
131 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
132 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
137 if test -n "$MODERN"; then
138 [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
140 echo "Stopping $DESC" "$NAME"
143 if test -n "$MODERN"; then
145 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
146 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
150 restart|force-reload)
151 if test -n "$MODERN"; then
152 log_daemon_msg "Restarting $DESC" "$NAME"
154 echo "Restarting $DESC" "$NAME"
159 if test -n "$MODERN"; then
172 echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2