aboutsummaryrefslogtreecommitdiff
path: root/sh/runscript.sh
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2007-12-04 16:15:32 +0000
committerRoy Marples <roy@marples.name>2007-12-04 16:15:32 +0000
commit07e3d69c52c44fd4953db1c7ef3431b053e3f775 (patch)
tree76d2f10ec16a149a40703be8a9c15693bd0a9b92 /sh/runscript.sh
parent09f949de5e6990786a01acf5b3e1262e8ac846eb (diff)
Our default start command should correctly recover on failed re-entrant services
Diffstat (limited to 'sh/runscript.sh')
-rwxr-xr-xsh/runscript.sh25
1 files changed, 17 insertions, 8 deletions
diff --git a/sh/runscript.sh b/sh/runscript.sh
index 641febcf..9ad22d45 100755
--- a/sh/runscript.sh
+++ b/sh/runscript.sh
@@ -109,20 +109,29 @@ unset _f
if [ -n "${command}" ]; then
if ! type start >/dev/null 2>&1; then
start() {
+ local _background=
ebegin "Starting ${name:-${SVCNAME}}"
- case "${command_background}" in
- [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
- start_stop_daemon_args="${start_stop_daemon_args} --background --pidfile"
- ;;
- esac
- yesno "${start_inactive}" && mark_service_inactive "${SVCNAME}"
+ if yesno "${command_background}"; then
+ _background="--background --pidfile"
+ fi
+ if yesno "${start_inactive}"; then
+ local _inactive=false
+ service_inactive "${SVCNAME}" && _inactive=true
+ mark_service_inactive "${SVCNAME}"
+ fi
start-stop-daemon --start \
--exec ${command} \
${procname:+--name} ${procname} \
${pidfile:+--pidfile} ${pidfile} \
- ${start_stop_daemon_args} \
+ ${_background} ${start_stop_daemon_args} \
-- ${command_args}
- eend $? "Failed to start ${SVCNAME}"
+ eend $? "Failed to start ${SVCNAME}" && return 0
+ if yesno "${start_inactive}"; then
+ if ! ${_inactive}; then
+ mark_service_stopped "${SVCNAME}"
+ fi
+ fi
+ return 1
}
fi
fi