X-Git-Url: https://git.archive.openwrt.org/?a=blobdiff_plain;f=contrib%2Fpackage%2Ffreifunk-watchdog%2Fsrc%2Fwatchdog.h;h=71c10e9c1fcbbffb33950417fac8de0b5a315a73;hb=a0dbf69b83e932370562948146f08195c6cf130d;hp=7de24210a682a7631d773d25c27dc71f92960439;hpb=34f8367c780bb3b9135e9882df6d1a180742aad4;p=project%2Fluci.git diff --git a/contrib/package/freifunk-watchdog/src/watchdog.h b/contrib/package/freifunk-watchdog/src/watchdog.h index 7de24210a..71c10e9c1 100644 --- a/contrib/package/freifunk-watchdog/src/watchdog.h +++ b/contrib/package/freifunk-watchdog/src/watchdog.h @@ -28,16 +28,23 @@ #include #include #include +#include +#include #include #include #include +#include +#include #include "ucix.h" #include "wireless.22.h" -/* Check interval */ -#define INTERVAL 30 +/* Watchdog poll interval */ +#define BASE_INTERVAL 5 + +/* Action interval (N * BASE_INTERVAL) */ +#define ACTION_INTERVAL 6 /* Hysteresis */ #define HYSTERESIS 3 @@ -51,6 +58,18 @@ /* Crond error action */ #define CRON_ACTION "/etc/init.d/cron", "/etc/init.d/cron", "restart" +/* SSHd error action */ +#define SSHD_ACTION "/etc/init.d/dropbear", "/etc/init.d/dropbear", "restart" + +/* Watchdog device */ +#define WATCH_DEVICE "/dev/watchdog" +#define WATCH_SHUTDOWN 'V' +#define WATCH_KEEPALIVE '\0' + +/* System load error action and treshold */ +#define LOAD_TRESHOLD 15.00 +#define LOAD_ACTION "/sbin/reboot", "/sbin/reboot" + /* Fallback binary name (passed by makefile) */ #ifndef BINARY #define BINARY "ffwatchd" @@ -89,22 +108,20 @@ iw_ioctl(int skfd, /* Socket to the kernel */ } /* fork() & execl() helper */ -#define EXEC(x) \ - do { \ - switch(fork()) \ - { \ - case -1: \ - syslog(LOG_CRIT, "Unable to fork child: %s", \ - strerror(errno)); \ - \ - break; \ - \ - case 0: \ - execl(x, NULL); \ - syslog(LOG_CRIT, "Unable to execute action: %s", \ - strerror(errno)); \ - \ - return 1; \ - } \ +#define EXEC(x) \ + do { \ + switch(fork()) \ + { \ + case -1: \ + syslog(LOG_CRIT, "Unable to fork child: %s", \ + strerror(errno)); \ + break; \ + \ + case 0: \ + execl(x, NULL); \ + syslog(LOG_CRIT, "Unable to execute action: %s", \ + strerror(errno)); \ + return 1; \ + } \ } while(0)