summaryrefslogtreecommitdiff
path: root/debian
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2002-08-12 03:21:53 +0000
committerPeter Palfrader <peter@palfrader.org>2002-08-12 03:21:53 +0000
commit2ed44f09565443e40f457bc930407d228d7d6669 (patch)
tree1348db5fce64826a9275d40968915d3d80b59038 /debian
parent6f302831426c72fc1f13b124ae8152fadd2321fb (diff)
Remove stale lockfile
Diffstat (limited to 'debian')
-rwxr-xr-xdebian/echolot.init46
1 files changed, 29 insertions, 17 deletions
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 \