aboutsummaryrefslogtreecommitdiffstats
path: root/debian/osmo-stp.init
diff options
context:
space:
mode:
Diffstat (limited to 'debian/osmo-stp.init')
-rwxr-xr-xdebian/osmo-stp.init16
1 files changed, 5 insertions, 11 deletions
diff --git a/debian/osmo-stp.init b/debian/osmo-stp.init
index 8488505..1584fd3 100755
--- a/debian/osmo-stp.init
+++ b/debian/osmo-stp.init
@@ -45,7 +45,9 @@ do_start()
# 2 if daemon could not be started
start-stop-daemon --start --quiet --exec $DAEMON --test > /dev/null \
|| return 1
- start-stop-daemon --start --quiet --background --exec $DAEMON -- \
+ start-stop-daemon --start --quiet --background \
+ --pidfile /var/run/$NAME.pid --make-pidfile \
+ --exec $DAEMON -- \
$DAEMON_ARGS \
|| return 2
# Add code here, if necessary, that waits for the process to be ready
@@ -63,17 +65,9 @@ do_stop()
# 1 if daemon was already stopped
# 2 if daemon could not be stopped
# other if a failure occurred
- start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --name $NAME
+ start-stop-daemon --stop --pidfile /var/run/$NAME.pid --quiet --retry=TERM/30/KILL/5 --name $NAME
RETVAL="$?"
- [ "$RETVAL" = 2 ] && return 2
- # Wait for children to finish too if this is a daemon that forks
- # and if the daemon is only ever run from this initscript.
- # If the above conditions are not satisfied then add some other code
- # that waits for the process to drop all resources that could be
- # needed by services started subsequently. A last resort is to
- # sleep for some time.
- start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
- [ "$?" = 2 ] && return 2
+ rm /var/run/$NAME.pid 2> /dev/null
return "$RETVAL"
}