aboutsummaryrefslogtreecommitdiff
path: root/etc
diff options
context:
space:
mode:
authorMatthias Schwarzott <zzam@gentoo.org>2008-06-12 14:39:45 +0000
committerMatthias Schwarzott <zzam@gentoo.org>2008-06-12 14:39:45 +0000
commitf6dc66a64bdf16d4dfcb19c25118b21a71c651b0 (patch)
tree6e399faa6a401a2e6c2e6c82cf625044b5188e1c /etc
parentRemove forgotten line. (diff)
downloadgentoo-vdr-scripts-f6dc66a64bdf16d4dfcb19c25118b21a71c651b0.tar.gz
gentoo-vdr-scripts-f6dc66a64bdf16d4dfcb19c25118b21a71c651b0.tar.bz2
gentoo-vdr-scripts-f6dc66a64bdf16d4dfcb19c25118b21a71c651b0.zip
Move watchdog code directly into init-script.
svn path=/gentoo-vdr-scripts/trunk/; revision=608
Diffstat (limited to 'etc')
-rwxr-xr-xetc/init.d/vdr51
1 files changed, 43 insertions, 8 deletions
diff --git a/etc/init.d/vdr b/etc/init.d/vdr
index b3ada26..95d5704 100755
--- a/etc/init.d/vdr
+++ b/etc/init.d/vdr
@@ -4,6 +4,8 @@
opts="${opts} watchdogrestart"
+. /etc/conf.d/vdr.watchdogd
+
load_functions() {
cd /
. /usr/share/vdr/inc/functions.sh
@@ -27,7 +29,7 @@ depend() {
after checkroot
}
-start() {
+start_vdr() {
INIT_PHASE="start"
load_functions
@@ -99,7 +101,7 @@ start() {
return $exitcode
}
-stop() {
+stop_vdr() {
INIT_PHASE="stop"
load_functions
load_addons_prefixed pre-stop
@@ -115,22 +117,55 @@ stop() {
return $exitcode
}
+start_watchdog() {
+ [ "${ENABLE_EXTERNAL_WATCHDOG:-yes}" = "yes" ] || return 0
+ ebegin "Starting vdr watchdog"
+ start-stop-daemon \
+ --start \
+ --background \
+ --make-pidfile \
+ --pidfile /var/run/vdrwatchdog.pid \
+ --exec /usr/sbin/vdr-watchdogd \
+ --name vdr-watchdogd
+ eend $? "failed starting vdr watchdog"
+ return 0
+}
+
+
+stop_watchdog() {
+ if [ "${ENABLE_EXTERNAL_WATCHDOG:-yes}" = "yes" ]; then
+ ebegin "Stopping vdr watchdog"
+ start-stop-daemon --stop --pidfile /var/run/vdrwatchdog.pid --name vdr-watchdogd
+ eend $? "failed stopping watchdog"
+ else
+ # Also stop watchdog if conf was changed to disabled while it was running
+ start-stop-daemon --stop --pidfile /var/run/vdrwatchdog.pid --name vdr-watchdogd --quiet
+ fi
+ return 0
+}
+
+start() {
+ start_vdr || return 1
+ start_watchdog || return 2
+}
+
+stop() {
+ stop_watchdog || return 2
+ stop_vdr
+}
+
# gets called by watchdog to restart vdr
# and possibly reload modules
watchdogrestart() {
load_functions
- export WATCHDOG_RESTART="1"
- /etc/init.d/vdr --nodeps stop
+ stop_vdr
if test_vdr_process; then
sleep 2
test_vdr_process && killall -9 vdr
fi
- /etc/init.d/vdr zap
-
load_addons_prefixed watchdog-restart
- /etc/init.d/vdr start
- unset WATCHDOG_RESTART
+ start_vdr
}