summaryrefslogtreecommitdiffhomepage
path: root/contrib/package/freifunk-watchdog/src
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2009-05-04 20:02:47 +0000
committerJo-Philipp Wich <jow@openwrt.org>2009-05-04 20:02:47 +0000
commit34f8367c780bb3b9135e9882df6d1a180742aad4 (patch)
tree8a4be0299b1b1dfb76210cc811b23e4d756e942d /contrib/package/freifunk-watchdog/src
parent970fe52726932081b11c4c19276d0bf3222b0f70 (diff)
contrib/package: introduce hysteresis in watchdog
Diffstat (limited to 'contrib/package/freifunk-watchdog/src')
-rw-r--r--contrib/package/freifunk-watchdog/src/watchdog.c6
-rw-r--r--contrib/package/freifunk-watchdog/src/watchdog.h3
2 files changed, 7 insertions, 2 deletions
diff --git a/contrib/package/freifunk-watchdog/src/watchdog.c b/contrib/package/freifunk-watchdog/src/watchdog.c
index 12d4badec3..b431b6dae4 100644
--- a/contrib/package/freifunk-watchdog/src/watchdog.c
+++ b/contrib/package/freifunk-watchdog/src/watchdog.c
@@ -318,16 +318,18 @@ static int do_daemon(void)
/* Wifi restart required? */
- if( restart_wifi > 0 )
+ if( restart_wifi >= HYSTERESIS )
{
restart_wifi = 0;
+ syslog(LOG_WARNING, "Restarting wireless");
EXEC(WIFI_ACTION);
}
/* Cron restart required? */
- if( restart_cron > 0 )
+ if( restart_cron >= HYSTERESIS )
{
restart_cron = 0;
+ syslog(LOG_WARNING, "Restarting crond process");
EXEC(CRON_ACTION);
}
diff --git a/contrib/package/freifunk-watchdog/src/watchdog.h b/contrib/package/freifunk-watchdog/src/watchdog.h
index d11396f807..7de24210a6 100644
--- a/contrib/package/freifunk-watchdog/src/watchdog.h
+++ b/contrib/package/freifunk-watchdog/src/watchdog.h
@@ -39,6 +39,9 @@
/* Check interval */
#define INTERVAL 30
+/* Hysteresis */
+#define HYSTERESIS 3
+
/* How to call myself in the logs */
#define SYSLOG_IDENT "Freifunk Watchdog"