]> code.citadel.org Git - citadel.git/blobdiff - citadel/debian/citadel.init
* to much c-coding spoilz bash-sk1lz
[citadel.git] / citadel / debian / citadel.init
index 40610d8f6172014b30d28ca63eeef5e8b318dd85..15dcdbf91039f8fdafc912c3921daa47cd9df25b 100644 (file)
@@ -1,6 +1,6 @@
 #!/bin/sh
 ### BEGIN INIT INFO
-# Provides:          citadel-server
+# Provides:          citadel
 # Required-Start:    $local_fs $remote_fs
 # Required-Stop:     $local_fs $remote_fs
 # Default-Start:     2 3 4 5
 ### END INIT INFO
 
 # Author: Wilfried Goesgens <citadel@outgesourced.org>
+
 RUNDIR=/var/run/citadel
 PATH=/sbin:/usr/sbin:/bin:/usr/bin
 DESC="Citadel Groupware "
 NAME=citserver
 DAEMON=/usr/sbin/$NAME
+PIDFILE=$RUNDIR/citadel.pid
 DAEMON_ARGS=" -d -x3 -lmail -t/dev/null"
-PIDFILE=$RUNDIR/$NAME.pid
 SCRIPTNAME=/etc/init.d/citadel
 SENDCOMMAND=/usr/sbin/sendcommand
 
-
 # Exit if the package is not installed
 [ -x "$DAEMON" ] || exit 0
 
 # Read configuration variable file if it is present
 [ -r /etc/default/$NAME ] && . /etc/default/$NAME
 
-# check if we 've got a newer system, so we can do fancy colors and so on.
 MODERN=
 
 # Load the VERBOSE setting and other rcS variables
@@ -75,17 +74,24 @@ do_stop()
        #   other if a failure occurred
         if $SENDCOMMAND "DOWN" >/dev/null 2>&1 ; then
            rm -f $PIDFILE
-
+           count=0;
            while test -S /var/run/citadel/citadel.socket; do 
+               count=$(($count+1))
                sleep 1
                echo -n "."
+               if test "$count" = "10"; then
+                   killall citserver
+               fi
+               if test "$count" = "20"; then
+                   killall -9 citserver
+                   rm -rf /var/run/citadel/*
+               fi
            done
                return 0
        else
            rm -f $PIDFILE
            return 2
        fi
-
 }
 
 #
@@ -156,9 +162,9 @@ case "$1" in
        fi
        ;;
   *)
-       echo "Usage: $SCRIPTNAME {start|stop|restart}" >&2
+       echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
        exit 3
        ;;
 esac
 
-exit 0
\ No newline at end of file
+exit 0