From 0ff2553ea21f8b9cb0934865e8a2d65a01161140 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Sat, 16 May 2009 17:20:50 +0000 Subject: [PATCH] luci-0.8: merge init script changes from r4530 --- .../files/freifunk-watchdog.init | 17 +++++++++++------ 1 file 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() -- 2.25.1