before i use the old OH 4.2 i could reboot my RPi via Item.
Now i got this error after Updating to OH 4.3.1.
Error occurred when executing commandLine '[sudo@@reboot]'
java.io.IOException: Cannot run program "sudo@@reboot": error=2, Datei oder Verzeichnis nicht gefunden
rule:
rule "Reboot RPI"
when
Item Flag_System received command "Reboot"
then
logInfo("Flag_System", "Rebooting openHAB")
executeCommandLine("sudo@@reboot") //OH2 version
//or
executeCommandLine("sudo","reboot") //OH3 version with new executeCommandLine syntax
end
Are you sure that your rule was working before?
For a reboot you need elevated rights which require to enter a password. You can avoid this by changing the sudoers file. Did you do that or do you use oh exec binding?
Can you please post the log?
edit:
Please also change your command to:
var result = executeCommandLine(Duration.ofSeconds(2), "sudo", "reboot")
logInfo("Info", result)
22:48:12.270 [INFO ] [org.openhab.core.model.script.Info ] - sudo: Zum Lesen des Passworts ist ein Terminal erforderlich; verwenden Sie entweder die Option -S, um aus der Standardeingabe zu lesen oder richten Sie das Askpass-Hilfsprogramm ein
sudo: Ein Passwort ist notwendig
The command is issued as user openhab. The error indicates, that this user needs to enter a password for issuing commands with root priviliges.
If this has worked before the update, something has changed outside openhab.
You should check the sudo settings for user openhab.