summaryrefslogtreecommitdiffhomepage
path: root/contrib/package/freifunk-watchdog/files/freifunk-watchdog.init
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/package/freifunk-watchdog/files/freifunk-watchdog.init')
-rwxr-xr-xcontrib/package/freifunk-watchdog/files/freifunk-watchdog.init24
1 files changed, 24 insertions, 0 deletions
diff --git a/contrib/package/freifunk-watchdog/files/freifunk-watchdog.init b/contrib/package/freifunk-watchdog/files/freifunk-watchdog.init
new file mode 100755
index 0000000000..9ca43754d7
--- /dev/null
+++ b/contrib/package/freifunk-watchdog/files/freifunk-watchdog.init
@@ -0,0 +1,24 @@
+#!/bin/sh /etc/rc.common
+
+START=99
+PID=/var/run/ffwatchd.pid
+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
+
+ start
+}
+
+start()
+{
+ start-stop-daemon -q -b -m -p $PID -x $BIN -S
+}
+
+stop()
+{
+ start-stop-daemon -q -p $PID -x $BIN -K
+}