3

I need to configure linux software watchdog (enabled in kernel configuration - CONFIG_SOFT_WATCHDOG=y, which gives me a new device /dev/watchdog1) such that if enabled and if a watchdog timeout occurs, it can launch a script/binary, instead of rebooting the system. My platform uses systemd and not init and I do not see a watchdog.conf file in /etc

Could not find a solution in how to use linux software watchdog. However, one comment says that " it is very possible to restart single or multiple processes after the watchdog signals that the systems is hanging - you can even ABORT the reboot or do a SOFT-reboot, one is able to configure "test" and "repair"-scripts / binaries which do whatever you want them to do."

How/Where can I configure /dev/watchdog1 so that it launches a script/binary instead of rebooting the system?

mbedsys
  • 31
  • 1
  • 3
  • 2
    `man watchdog ; man watchdog.conf` and read about the *repair binary*. – Nate Eldredge Apr 11 '19 at 03:44
  • It turns out that my system does not use the linux watchdog daemon and so no watchdog.conf. A custom process opens the watchdog device (/dev/watchdog), sets the timeout using ioctl and then keeps petting(WDIOC_KEEPALIVE) it. So the configuration is default. Is there another way to change the default behavior of watchdog timeout to run a script? I don't see na ioctl to do so in [watchdog.h](https://github.com/torvalds/linux/blob/master/include/uapi/linux/watchdog.h) – mbedsys Apr 12 '19 at 20:51

1 Answers1

0

Eventually resorting to looking at the kernel source for watchdog drivers helped clear things for me. There is no way to configure /dev/watchdog1 or a kernel watchdog driver (hardware or software(softdog)), to be precise, to launch a script/binary instead of causing a system reboot. For this purpose, if feasible, you will have to write your own watchdog driver. The "launching script/binary" configuration that I was led to chase is associated with application space "watchdog daemon" (and has nothing to do with kernel's watchdog driver's configuration/behavior) which can launch a custom script to test your system health and try to fix things before a system reboot is necessary.

mbedsys
  • 31
  • 1
  • 3