Hi all
Can someone please tell me what is wrong with these 2 rules?
rule "Restart OpenHAB2 service"
when
Time cron "0 18 16 * * ? *"
then
executeCommandLine('"sudo" "systemctl" "restart" "openhab2.service"', 5000)
end
or this
rule "Restart OpenHAB2 service"
when
Time cron "0 18 16 * * ? *"
then
executeCommandLine('"sudo systemctl restart openhab2.service"', 5000)
end
1 or 2 doesn’t seem to effect Openhab2.
My OH2 system starts as a service, and I rather restart the service, than reboot entire raspberry.
I do not get any error messages in the log.
Thanks in advance.
hr3
(Harry)
2
I use this and it works
executeCommandLine("python /etc/openhab2/scripts/xxx.py 0x20 "+argument2+' '+argument3)
So you are just running a script, that only restarts the service? @hr3
If I run the command
sudo systemctl restart openhab2.service
in a shell on my pi3, then it works, but not in OH… why is that?
Do I have user / permission issues?
Try searching the forum, there has been a lot written about it already:
Sorry can’t help you directly as I am not using the exec binding or try to run sudo commands
And
Yes, most likely, OH2 is openhab as user and has no sudo rights as far as I remember; also you may always need the full path to your commands;