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 # Author: Wilfried Goesgens <citadel@outgesourced.org>
14 RUNDIR=/var/run/citadel
15 PATH=/sbin:/usr/sbin:/bin:/usr/bin
16 DESC="Citadel Groupware "
18 DAEMON=/usr/sbin/$NAME
19 PIDFILE=$RUNDIR/citadel.pid
20 DAEMON_ARGS=" -d -x3 -lmail -t/dev/null"
21 SCRIPTNAME=/etc/init.d/citadel
22 SENDCOMMAND=/usr/sbin/sendcommand
24 # Exit if the package is not installed
25 [ -x "$DAEMON" ] || exit 0
27 # Read configuration variable file if it is present
28 [ -r /etc/default/$NAME ] && . /etc/default/$NAME
32 # Load the VERBOSE setting and other rcS variables
33 if test -f /lib/init/vars.sh ; then
37 # Define LSB log_* functions.
38 # Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
39 if test -f /lib/lsb/init-functions; then
40 . /lib/lsb/init-functions
45 # Function that starts the daemon/service
49 # for ubuntu: check our volatile dirs.
50 if test ! -d $RUNDIR; then
54 # 0 if daemon has been started
55 # 1 if daemon was already running
56 # 2 if daemon could not be started
66 # Function that stops the daemon/service
71 # 0 if daemon has been stopped
72 # 1 if daemon was already stopped
73 # 2 if daemon could not be stopped
74 # other if a failure occurred
75 if $SENDCOMMAND "DOWN" >/dev/null 2>&1 ; then
78 while test -S /var/run/citadel/citadel.socket; do
82 if test "$count" = "10"; then
85 if test "$count" = "20"; then
87 rm -rf /var/run/citadel/*
98 # Function that sends a SIGHUP to the daemon/service
108 if test -n "$MODERN"; then
109 [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
111 echo "Starting $DESC" "$NAME"
115 if test -n "$MODERN"; then
117 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
118 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
123 if test -n "$MODERN"; then
124 [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
126 echo "Stopping $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 ;;
136 restart|force-reload)
137 if test -n "$MODERN"; then
138 log_daemon_msg "Restarting $DESC" "$NAME"
140 echo "Restarting $DESC" "$NAME"
145 if test -n "$MODERN"; then
151 1) log_end_msg 1 ;; # Old process is still running
152 *) log_end_msg 1 ;; # Failed to start
165 echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2