summaryrefslogtreecommitdiff
path: root/meta-ibs/meta-common/recipes-phosphor/watchdog/system-watchdog/watchdog-reset
diff options
context:
space:
mode:
Diffstat (limited to 'meta-ibs/meta-common/recipes-phosphor/watchdog/system-watchdog/watchdog-reset')
-rw-r--r--meta-ibs/meta-common/recipes-phosphor/watchdog/system-watchdog/watchdog-reset18
1 files changed, 18 insertions, 0 deletions
diff --git a/meta-ibs/meta-common/recipes-phosphor/watchdog/system-watchdog/watchdog-reset b/meta-ibs/meta-common/recipes-phosphor/watchdog/system-watchdog/watchdog-reset
new file mode 100644
index 0000000000..3413fdb9f3
--- /dev/null
+++ b/meta-ibs/meta-common/recipes-phosphor/watchdog/system-watchdog/watchdog-reset
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+echo "Watchdog being started by $1" > /dev/kmsg
+
+if /sbin/fw_printenv bootfailures -n | grep -q 3; then
+ exit 0 # passed boot limit, user started again on purpose
+fi
+
+if test -f "/tmp/nowatchdog"; then
+ echo "Not resetting due to nowatchdog file" > /dev/kmsg
+ exit 0
+fi
+
+echo "Log as follows:" > /dev/kmsg
+journalctl -r -n 100 | while read line; do echo $line > /dev/kmsg; done
+
+systemctl stop system-watchdog.service
+/sbin/watchdog -T 0 -F /dev/watchdog1