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
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
76 # 0 if daemon has been stopped
77 # 1 if daemon was already stopped
78 # 2 if daemon could not be stopped
79 # other if a failure occurred
80 if $SENDCOMMAND "DOWN" >/dev/null 2>&1 ; then
81 if test ! -f "$PIDFILE"; then
82 echo Unable to find Citserver. Not running?
88 while test -S /var/run/citadel/citadel.socket -o -d /proc/$PID; do
92 if test "$count" = "10"; then
95 if test "$count" = "20"; then
97 rm -rf /var/run/citadel/*
108 # Function that sends a SIGHUP to the daemon/service
112 # 0 if daemon could not be restarted
113 # 1 if daemon has been restarted
114 # other if a failure occurred
115 if $SENDCOMMAND "DOWN 1" 2>&1|grep '200 Restarting'>/dev/null ; then
123 if test -n "$MODERN"; then
124 [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
126 echo "Starting $DESC" "$NAME"
130 if test -n "$MODERN"; then
132 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
133 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
138 if test -n "$MODERN"; then
139 [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
141 echo "Stopping $DESC" "$NAME"
144 if test -n "$MODERN"; then
146 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
147 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
151 restart|force-reload)
152 if test -n "$MODERN"; then
153 log_daemon_msg "Restarting $DESC" "$NAME"
155 echo "Restarting $DESC" "$NAME"
160 if test -n "$MODERN"; then
173 echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2