System Uptime Info and an Automatic Reboot

openhab2
openhab
uptime
Tags: #<Tag:0x00007f1e5a815540> #<Tag:0x00007f1e5a815400> #<Tag:0x00007f1e5a815298>
(Jerry) #21

Ahh, ok then. Thanks alot :slight_smile:

Uptime openHAB aN:aN whats wrong when i get aN:aN instead of the time?

0 Likes

(David Bontems) #22

Dear All

I applied the logic described above, tried different syntax/format, added notification to make the code was executed
but the Rasp is never rebooting, the line below does not move anything
executeCommandLine(’“sudo” “reboot”’, 5000)

Has anyone been successful with reboot from openhab rule ?
Thank you

0 Likes

(Martin Tamke) #23

Im not using the rule here, but would assume, that the rule can only reboot OpenHab, when the Openhab user is member of sudoers. Only than the Openhab user can trigger a reboot.

Have a look at this article, this might help you:

0 Likes

(Vincent Regaud) #24

What does the logs tell you?

0 Likes

(Rich Koshak) #25

I do not think it is possible to reboot the machine that OH is running on from OH itself. Here is the sequence of events.

  1. OH creates a shell
  2. OH calls reboot
  3. reboot sends out the “we’re going down!” signal to all running processes.
  4. OH receives the “we’re going down!” signal
  5. OH abruptly kills the shell it create to call the reboot command
  6. The reboot command get’s killed because the shell it was running in, it’s parent process, was killed
  7. The machine stops rebooting.

This seems to be the behavior when ever someone tries to do it. I do think this is a side effect from the fact that the reboot command’s parentage is something like:

systemd -> java -> shell -> reboot

Perhaps the reboot command can’t survive it’s grandparent process being killed the same way it can it’s parent process.

0 Likes

(David Bontems) #26

Thank you mdnx, I managed to get the reboot working by following your instruction

Regards
David

1 Like