X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fdebian%2Fcitadel.init;h=1d0d8b385185466e7d66bebb1f2d8c2cf119f245;hb=461630d5b05c060585772d664257746a90e595e8;hp=e38b0163febb126334def5e3f6d48f1575c10b8e;hpb=b614b5286cb14b5310400c2cb23ef6515b9d80a8;p=citadel.git diff --git a/citadel/debian/citadel.init b/citadel/debian/citadel.init index e38b0163f..1d0d8b385 100644 --- a/citadel/debian/citadel.init +++ b/citadel/debian/citadel.init @@ -23,7 +23,8 @@ PATH=/sbin:/usr/sbin:/bin:/usr/bin DESC="Citadel Groupware " NAME=citserver DAEMON=/usr/sbin/$NAME -DAEMON_ARGS=" -d -x3 -lmail" +CTDLSVC=/usr/lib/citadel-server/ctdlsvc +DAEMON_ARGS=" -x3 -lmail -t/dev/null" PIDFILE=$RUNDIR/$NAME.pid SCRIPTNAME=/etc/init.d/citadel SENDCOMMAND=/usr/sbin/sendcommand @@ -55,9 +56,12 @@ do_start() # 0 if daemon has been started # 1 if daemon was already running # 2 if daemon could not be started - start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \ - $DAEMON_ARGS \ - || return 2 + if $CTDLSVC $PIDFILE $DAEMON \ + $DAEMON_ARGS ; then + return 0 + else + return 2 + fi # Add code here, if necessary, that waits for the process to be ready # to handle requests from services started subsequently which depend # on this one. As a last resort, sleep for some time. @@ -73,13 +77,18 @@ do_stop() # 1 if daemon was already stopped # 2 if daemon could not be stopped # other if a failure occurred - %SENDCOMMAND "DOWN" + if $SENDCOMMAND "DOWN" >/dev/null 2>&1 ; then + rm -f $PIDFILE + return 0 + else + rm -f $PIDFILE + return 2 + fi #while test -d /proc/`cat $PIDFILE`; do # /usr/bin/printf '.' # /bin/sleep 1 #done - sleep 5 #start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME #RETVAL="$?" @@ -94,7 +103,6 @@ do_stop() #[ "$?" = 2 ] && return 2 # Many daemons don't delete their pidfiles when they exit. # rm -f $PIDFILE - return 0 } #