Hey all,
I tried running a system call to reboot
in a super desperate measure and I don’t think I ever got it working (I think it’s because reboot
must be called with sudo
or by a root user). I found using the Legato watchdog worked really well for masking problems like this.
The flow I used to achieve this was:
- Configure the app to expect a watchdog kick roughly on the same interval you’re expecting some data related event (pushing sensor data every 3 minutes in my case). Almost all of this config is in your application definition (
.adef
) file: Application Definition .adef - Legato Docs - Kick the watchdog in
COMPONENT_INIT
to make sure the watchdog starts with the app - Send a kick each time the data event happens successfully
If a kick is ever missed, the watchdog will follow the action specified by watchdogAction
in your corresponding .adef
file (reboot in my case). This is obviously a very brute force oriented solution, but nonetheless, it works extremely well.
If you’re looking for something a little cleaner, checkout the le_mrc interface. I haven’t really used this API much, but to my knowledge, some potentially dangerous calls exist in this API, so proceed carefully!
Let me know if some sample code would help clarify any of this and I’ll be happy to provide some.
Cheers!