Hi
I Want to perform a daily reboot to the rasp pi as I did in OpenHab 2.5.
But it seems that the command not doing anything.
Any idea to solve it?
This is the rule
rule "Reboot openHAB"
when
Item Flag_System received command "Reboot"
then
logInfo("Flag_System", "Rebooting openHAB")
executeCommandLine("sudo","reboot")
end
The log is writing successfully but no reboot.
Same with triggering the Flag_System via the sitemap.
Why would you think that would be needed? If it requires a daily reboot there is an issue that should be resolved before it causes further headache IMHO,
You right
In the past I did needed a daily reboot…
Now on OpenHab 3 I just want the option to reboot from remote.
So I have item in sitemap to change the Flag_System, the command is triggered but the reboot is not.
It’s most likely choking on the sudo part depending on the permissions you’ve set up. Depending on how you upgraded from 2.5 to 3 you might have lost whatever modifications you must have made to /etc/sudoers that permits the system to run that command with no password. But as Rich said, the best way to know for sure is get the output from the executeCommandLine and see.
As documented, you must supply a Duration as the first argument to executeCommandLine in order to cause it to wait for the command to finish and capture the command’s output.
We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.
sudo: no tty present and no askpass program specified
That message comes up the first time a user runs a sudo command and requires you to press “y” to acknowledge the message. Probably the easiest thing to do is open a terminal and run
sudo -u openhab /bin/bash
to get a shell as user openhab. The run
sudo ls
That message will appear and present you with a y/n prompt. From that point the message will not appear again and your executeCommandLine should work.