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

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.

  • 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? – KernelPanic Nov 20 '14 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 '14 at 16:47
  • mnt/data is mounted and ok – KernelPanic Nov 20 '14 at 18:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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