summaryrefslogtreecommitdiff
path: root/debian/echolot.init
diff options
context:
space:
mode:
Diffstat (limited to 'debian/echolot.init')
-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 \