Can anybody tell me how to handle the software watchdog in Linux?
I have a program SampleApplication
which runs continuously and I need to restart it if its hangs or closes unexpectedly.
I was Googling about this and found Linux has watchdog at /dev/watchdog
but don’t know how to use it. Could someone help me with an example?
My question is where to I specify my application name and delay interval to restart?
Most of the Unix/Linux init
programs will manage daemons for you and restart them. Look into placing your service in /etc/inittab
. Or you might be using Upstart
or systemd
.
All of these programs run as PID 1
and it is their job to monitor and restart system processes.
From your Busybox tag I would assume you are running an embedded system. On those, the System V style init scripts with all of their shell scripts are really overkill. You should probably rip all that out and replace it with entries in /etc/inittab
or upstart or systemd jobs.