3 # Provides: citadel-server
4 # Required-Start: $local_fs $remote_fs
5 # Required-Stop: $local_fs $remote_fs
6 # Default-Start: 2 3 4 5
8 # Short-Description: Citadel initscript
11 # Author: Wilfried Goesgens <citadel@outgesourced.org>
12 RUNDIR=/var/run/citadel
13 PATH=/sbin:/usr/sbin:/bin:/usr/bin
14 DESC="Citadel Groupware "
16 DAEMON=/usr/sbin/$NAME
17 DAEMON_ARGS=" -d -x3 -lmail -t/dev/null"
18 PIDFILE=$RUNDIR/$NAME.pid
19 SCRIPTNAME=/etc/init.d/citadel
20 SENDCOMMAND=/usr/sbin/sendcommand
23 # Exit if the package is not installed
24 [ -x "$DAEMON" ] || exit 0
26 # Read configuration variable file if it is present
27 [ -r /etc/default/$NAME ] && . /etc/default/$NAME
29 # check if we 've got a newer system, so we can do fancy colors and so on.
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
91 # Function that sends a SIGHUP to the daemon/service
101 if test -n "$MODERN"; then
102 [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
104 echo "Starting $DESC" "$NAME"
108 if test -n "$MODERN"; then
110 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
111 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
116 if test -n "$MODERN"; then
117 [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
119 echo "Stopping $DESC" "$NAME"
122 if test -n "$MODERN"; then
124 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
125 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
129 restart|force-reload)
130 if test -n "$MODERN"; then
131 log_daemon_msg "Restarting $DESC" "$NAME"
133 echo "Restarting $DESC" "$NAME"
138 if test -n "$MODERN"; then
144 1) log_end_msg 1 ;; # Old process is still running
145 *) log_end_msg 1 ;; # Failed to start
158 echo "Usage: $SCRIPTNAME {start|stop|restart}" >&2