recommended watchdog usage
james at virtualjames.com
Wed Mar 18 23:54:47 CET 2015
Thanks for the response Ronny.
I'm hoping to use the hardware watchdog timer (bcm2708_wdog). This pi is
going into a public art piece which has a 30 year lifespan. It needs to be
robust to both OS weirdness as well as application hangs. It's fine if the
whole pi reboots.
It looks like all the plumbing is there to use the bcm2708_wdog:
- it's enabled in the kernel config
- it's listed in /etc/modules
A couple of notable things
1. there is no /etc/watchdog.conf
2. most of the raspbian-centric howtos mention a watchdog daemon (ie.
apt-get install watchdog chkconfig)
re: #1, could be the problem, but I would expect it to run under default
values. I'll investigate tonight. I just haven't had time to track down a
template config file.
re: #2, my understanding is the daemon just watches for OS issues.
I think I should still be able to interact with the watchdog timer from my
C code, thus protecting my app from crashes/freezes. I just get a "can't
open '/dev/watchdog': Device or resource busy" when I try to use it.
I'll keep investigating, but if anyone has any nuggets of wisdom I'm all
On Tue, Mar 17, 2015 at 8:46 PM, Ronny Nilsson <
rln-nard at arbetsmyra.dyndns.org> wrote:
> I'm guessing you want to restart your application if it crashes(?). Is it a
> daemon which forks to background or does it run in the foreground? In the
> later case a simple shell script like this should do the work:
> until /opt/my-app; do
> sleep 1
> This script in turn should be executed from within /etc/rc.<product> with:
> start-stop-daemon -bSx /opt/my-restater.sh -p /var/run/my-restater.pid -m
> Note that such a simple script restart your application only in the event
> has terminated. It won't detect freezes or lockups. It can however be added
> by for example monitoring for the existence of a file in /tmp which you
> regularly re-create in your application.
> > I'm just familiarizing myself with NARD, but I'd like to make use the
> > watchdog to restart my app. There seems to be a dearth of information out
> > there about how to use it, but this page seems helpful:
> > https://embeddedfreak.wordpress.com/2010/08/23/howto-use-linux-watchdog/
> > I tried running the /sbin/watchdog command in the foreground, just as a
> > test, but it didn't seem to work:
> > root at skeleton-c7640e49:/mnt/sdcard/user> watchdog -F /dev/watchdog
> > watchdog: can't open '/dev/watchdog': Device or resource busy
> > Does this look like the correct invocation?
> > Many thanks, this SDK is pretty awesome so far.
> > Best,
> > James
More information about the Nard