From 2ed44f09565443e40f457bc930407d228d7d6669 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Mon, 12 Aug 2002 03:21:53 +0000 Subject: Remove stale lockfile --- debian/echolot.init | 46 +++++++++++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 17 deletions(-) (limited to 'debian/echolot.init') diff --git a/debian/echolot.init b/debian/echolot.init index 3e38c05..c5d9804 100755 --- a/debian/echolot.init +++ b/debian/echolot.init @@ -23,21 +23,27 @@ test -f $DAEMON || exit 0 wait_for_deaddaemon () { PID=$1 sleep 3 - if test -n "$PID" && kill -0 $PID 2>/dev/null - then - echo -n "Waiting for pid $PID ." - cnt=0 - while kill -0 $PID 2>/dev/null - do - cnt=`expr $cnt + 1` - if [ $cnt -gt 30 ] - then - echo -n " Failed.. " - break - fi - sleep 2 - echo -n "." - done + if test -n "$PID" + then + if kill -0 $PID 2>/dev/null + then + echo -n "Waiting for pid $PID ." + cnt=0 + while kill -0 $PID 2>/dev/null + do + cnt=`expr $cnt + 1` + if [ $cnt -gt 30 ] + then + echo -n " Failed.. " + break + fi + sleep 2 + echo -n "." + done + rm -f /var/run/echolot/pingd.pid + else + rm -f /var/run/echolot/pingd.pid + fi fi } @@ -80,8 +86,14 @@ case $1 in start) if [ -f $PIDFILE ] ; then - echo "Pidfile $PIDFILE already exists" >&2 - exit 1 + PID=`cat $PIDFILE 2>/devnull` || true + if kill -0 $PID 2>/dev/null + then + echo "$DESC already running" + exit 0 + else + rm -f /var/run/echolot/pingd.pid + fi fi echo -n "Starting $DESC: " start-stop-daemon \ -- cgit v1.2.3