keystroke activated watchdog #1020
Conversation
|
I'll take a look later.. since matron is parent process of shell it's probably getting shut down prematurely? |
| if(stage==3) count++; | ||
| if(count==10) { | ||
| fprintf(stderr, "RESTARTING...\n"); | ||
| system("systemctl restart norns-*"); |
catfact
Feb 26, 2020
•
Collaborator
yeah, pretty sure the plain system("systemctl ...) won't work because as soon as matron is stopped the child shell will also be killed.
this SO question has some ideas, namely:
system("setsid .... &")
- something suspiciously complicated with
fork(), execl(), waitpid() and so on
https://stackoverflow.com/questions/17599096/how-to-spawn-child-processes-that-dont-die-with-parent
yeah, pretty sure the plain system("systemctl ...) won't work because as soon as matron is stopped the child shell will also be killed.
this SO question has some ideas, namely:
system("setsid .... &")- something suspiciously complicated with
fork(),execl(),waitpid()and so on
https://stackoverflow.com/questions/17599096/how-to-spawn-child-processes-that-dont-die-with-parent
|
Another possibly more simple option (not tested) would be to define another systemd service which watches for changes to a specific file on disk and runs the service as a result. ...one could imagine the file watcher service simple restarts the |
|
pretty sure i fixed it with a |
|
anyone see a problem with this? tested and confirmed working. i should probably try more crash-scenarios, if anyone has suggestions |
|
Didn't we want to restart the whole system with key-combo? Otherwise the only way to restart with an unresponsive device is to kill the power with the button on the bottom. Regarding testing: I'm not really sure how to really test if this works. One know case seems to be if the UI doesn't respond, maybe by creating an infinite loop in a script? |
further fixes #1014
in sequence, hold K3, K2, K1. if 10s elapses, services are restart.
however, weird thing i'm seeing:
despite
systemctl restart norns-*it seems like only matron is being restarted? ie, i don't get the startup animation and things start almost immediately. running the same command on the command line does what we want?