summaryrefslogtreecommitdiffhomepage
path: root/contrib/package/freifunk-watchdog/files
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2009-05-16 17:19:06 +0000
committerJo-Philipp Wich <jow@openwrt.org>2009-05-16 17:19:06 +0000
commit07b6a704c4e121d603307bcf5d036651e23d3532 (patch)
tree5ba03098c75742a51fd59d58e3e1cc8252ba395f /contrib/package/freifunk-watchdog/files
parent82b15b30abd1ed278550bdeb38168462d0b91674 (diff)
merge r4529 to trunk
Diffstat (limited to 'contrib/package/freifunk-watchdog/files')
-rwxr-xr-xcontrib/package/freifunk-watchdog/files/freifunk-watchdog.init17
1 files changed, 11 insertions, 6 deletions
diff --git a/contrib/package/freifunk-watchdog/files/freifunk-watchdog.init b/contrib/package/freifunk-watchdog/files/freifunk-watchdog.init
index 1cce46b4a..1f87bf744 100755
--- a/contrib/package/freifunk-watchdog/files/freifunk-watchdog.init
+++ b/contrib/package/freifunk-watchdog/files/freifunk-watchdog.init
@@ -6,15 +6,20 @@ BIN=/usr/sbin/ffwatchd
boot()
{
- if ! grep -q "$BIN" /etc/crontabs/root 2>/dev/null; then
- echo "* * * * * $BIN running || /etc/init.d/freifunk-watchdog restart" >> /etc/crontabs/root
- fi
+ # If watchdog service is enabled, install cronjob, create device node and start daemon
+ if /etc/init.d/freifunk-watchdog enabled 2>/dev/null; then
+ if ! grep -q "$BIN" /etc/crontabs/root 2>/dev/null; then
+ echo "* * * * * $BIN running || /etc/init.d/freifunk-watchdog restart" >> /etc/crontabs/root
+ fi
- if lsmod | grep -q softdog; then
mknod /dev/watchdog c 10 130
- fi
- start
+ start
+
+ # If service is disabled, find and remove related cronjob
+ elif grep -q "$BIN" /etc/crontabs/root 2>/dev/null; then
+ sed -i -e "\\'$BIN'd" /etc/crontabs/root
+ fi
}
start()