Last active
February 23, 2017 04:23
-
-
Save xenithorb/fe93512746099e2173e5d7f12e7c2527 to your computer and use it in GitHub Desktop.
One-liner to enable Rasbperry Pi 3 watchdog timer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if [[ -c /dev/watchdog ]]; then if [[ -d /etc/systemd ]]; then mkdir /etc/systemd/system.conf.d &>/dev/null; else { echo "ERROR: No systemd"; exit; }; fi; echo -e "[Manager]\nRuntimeWatchdogSec=10\nShutdownWatchdogSec=3min" > /etc/systemd/system.conf.d/watchdog.conf; else { echo "No watchdog device present"; exit; }; fi && systemctl daemon-reload && systemctl daemon-reexec && systemctl show | grep Watchdog |
On some tests it took about 4 minutes from the start of the fork bomb as a normal user to hang the system ( this seems to go much quicker as root as I assume due to the fact of not having limits as root. )
Once the system became totally unresponsive to ping
it was unreachable for 11 seconds, and came back up immediately. It then showed an uptime
of 0min confirming that a reboot occurred.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
After it's enabled you can test with a bash or perl forkbomb:
The system at some point should reboot when the watchdog can no longer be contacted for 5 seconds