Implement Command watchdog
Objective
Have a command, watchdog, which does the following
help page
BusyBox v1.24.1 (2016-02-19 11:20:55 SGT) multi-call binary.
Usage: watchdog [-t N[ms]] [-T N[ms]] [-F] DEV
Periodically write to watchdog device DEV
-T N Reboot after N seconds if not reset (default 60)
-t N Reset every N seconds (default 30)
-F Run in foreground
Use 500ms to specify period in milliseconds
Done
- When the command complies with the above interface
- When it can be compiled as an applet into the slimbox binary
Demo
Show each command as an 'applet', and that it conforms to the interface:
$ slimbox watchdog --help
BusyBox v1.24.1 (2016-02-19 11:20:55 SGT) multi-call binary.
Usage: watchdog [-t N[ms]] [-T N[ms]] [-F] DEV
...
Show that when called as a symlink, the same happens
$ ln -s slimbox watchdog
$ ./watchdog --help
BusyBox v1.24.1 (2016-02-19 11:20:55 SGT) multi-call binary.
Usage: watchdog [-t N[ms]] [-T N[ms]] [-F] DEV
...