aboutsummaryrefslogtreecommitdiff
path: root/etc
diff options
context:
space:
mode:
authorMatthias Schwarzott <zzam@gentoo.org>2008-07-06 16:31:51 +0000
committerMatthias Schwarzott <zzam@gentoo.org>2008-07-06 16:31:51 +0000
commitf4acea57f0574261b9c303e5255d8089baf4cf33 (patch)
tree72ae5571985685f4603c830195a201eb2e2e7854 /etc
parentChanged message about died vdr process. (diff)
downloadgentoo-vdr-scripts-f4acea57f0574261b9c303e5255d8089baf4cf33.tar.gz
gentoo-vdr-scripts-f4acea57f0574261b9c303e5255d8089baf4cf33.tar.bz2
gentoo-vdr-scripts-f4acea57f0574261b9c303e5255d8089baf4cf33.zip
Try to handle signals in init-script better. Make sure that vdr does not run if init-script gets killed, and at end of stop.
svn path=/gentoo-vdr-scripts/trunk/; revision=632
Diffstat (limited to 'etc')
-rwxr-xr-xetc/init.d/vdr32
1 files changed, 24 insertions, 8 deletions
diff --git a/etc/init.d/vdr b/etc/init.d/vdr
index 58b536a..81f8308 100755
--- a/etc/init.d/vdr
+++ b/etc/init.d/vdr
@@ -69,12 +69,19 @@ start_vdr() {
eval ${_openvt} start-stop-daemon ${daemonctrl_opts} -- ${vdr_opts}
vdr_exitcode=$?
eend $vdr_exitcode "Failed to start vdr."
-
+
# TODO: Anything todo if starting failed? cleanups?
- load_addons_prefixed post-start || vdr_exitcode=1
+ if [ $vdr_exitcode -lt 128 ]; then
+ load_addons_prefixed post-start || vdr_exitcode=1
+ fi
+
+ if [ $vdr_exitcode != 0 ]; then
+ # Make sure vdr really does not run
+ kill_vdr
+ fi
- # show if we have messages
+ # show messages if we have any
if [ "${vdr_exitcode}" = "0" -a -s "${VDR_LOG_FILE}" ]; then
/usr/share/vdr/bin/vdr-bg.sh svdrpsend.pl mesg "Errors: Go to Commands/View VDR Start Log"
fi
@@ -93,10 +100,23 @@ stop_vdr() {
exitcode=$?
eend $exitcode "Failed to stop vdr."
+ if [ $exitcode != 0 ]; then
+ kill_vdr
+ fi
+
load_addons_prefixed post-stop
- return $exitcode
+ return 0
}
+kill_vdr() {
+ killall ${VDR_BIN}
+ if test_vdr_process; then
+ sleep 2
+ test_vdr_process && killall -9 ${VDR_BIN}
+ fi
+}
+
+
start_watchdog() {
yesno "${ENABLE_EXTERNAL_WATCHDOG:-yes}" || return 0
ebegin "Starting vdr watchdog"
@@ -142,10 +162,6 @@ watchdogrestart() {
common_init
( stop_vdr )
- if test_vdr_process; then
- sleep 2
- test_vdr_process && killall -9 vdr
- fi
load_addons_prefixed watchdog-restart