]> code.citadel.org Git - citadel.git/blobdiff - citadel/debian/citadel.init
* evaluate the return of fgets() to silence some warnings
[citadel.git] / citadel / debian / citadel.init
index 918695ac9b64183bacc3d4697dec1d1a3f74df55..b61bec3ccd3e198c4577fb7534f0287f8278ca55 100644 (file)
@@ -9,6 +9,10 @@
 # Description:       control citadel server start at boot time
 ### END INIT INFO
 
+# uncomment this to create coredumps as described in
+# http://www.citadel.org/doku.php/faq:mastering_your_os:gdb#how.do.i.make.my.system.produce.core-files
+# ulimit -c unlimited
+
 # Author: Wilfried Goesgens <citadel@outgesourced.org>
 
 RUNDIR=/var/run/citadel
@@ -73,17 +77,22 @@ do_stop()
        #   2 if daemon could not be stopped
        #   other if a failure occurred
         if $SENDCOMMAND "DOWN" >/dev/null 2>&1 ; then
+           if test ! -f "$PIDFILE"; then 
+               echo Unable to find Citserver. Not running?
+               return 1
+           fi
+           PID=`cat $PIDFILE`
            rm -f $PIDFILE
            count=0;
-           while test -S /var/run/citadel/citadel.socket; do 
+           while test -S /var/run/citadel/citadel.socket -o -d /proc/$PID; do 
                count=$(($count+1))
                sleep 1
                echo -n "."
                if test "$count" = "10"; then
-                   killall citserver
+                   kill $PID
                fi
                if test "$count" = "20"; then
-                   killall -9 citserver
+                   kill -9 $PID
                    rm -rf /var/run/citadel/*
                fi
            done