2

My customer's java app - .jar file runs on rPi B+ with ArchLinux installed. Now, I've also enabled hardware watchdog timer which purpose is to reboot rPi when java app hangs. Now, I've configured the watchdog timer with (code chunk from /etc/watchdog.conf):

file            = /mnt/data/settings/octopus.watchdog
change          = 3600

max-temperature = 80

interval        = 1
logtick         = 1
log-dir         = /var/log/watchdog

realtime        = yes
priority        = 1

Then I restart service and I get reboot every 10 seconds. Why?! Then, the watchdog sends SIGTERM signal to processes before reboot and I've updated my java app with hook mechanism for catching SIGTEM signal, the purpose is saving settings and closing some file before reboot and this works ok. However, my question is does reboot phase "waits" for this java app to properly (to save and close the files) end or it simply kills the process?

1 Answer 1

1

I don't think it's the watchdog process that signals your app. It triggers the shutdown and the signal comes from init or the kernel.

SOP at shutdown is:

all processes are first notified that the system is going down by the signal SIGTERM. After an interval (see -t) all processes shall be sent the signal SIGKILL.

So if your clean-up is not too time consuming a SIGTERM handler should be fine. However, if this is a persistent service that runs from boot to shutdown, the best practice here would be to create an init service for it. I presume Arch on the pi uses systemd for this purpose.

3
  • Ok, but which watchdog tests are useful for my situation? I still do not know why rPi is being rebooted every 10 seconds (aproximately) related to shown configuration. And what is corelation between hearbeat, change and interval parameters? Nov 20, 2014 at 15:16
  • 1
    That's a distinct question and you'd probably be better off asking about it on the U&L Exchange. I've never used watchdog but looking at, e.g., man watchdog.conf I don't see anything that seems wrong -- unless it's starting before /mnt/data is mounted, in which case the first stat will fail.
    – goldilocks
    Nov 20, 2014 at 16:47
  • mnt/data is mounted and ok Nov 20, 2014 at 18:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.