This is not permissions issue as I tested the permissions with by
sudo -u openhab /bin/bash
sudo shutdown -r
As @rpwong suggested and it worked.
I added print of the output:
var String output = executeCommandLine("sudo","reboot")
logInfo("Flag_System", "executeCommandLine output " + output)
And got “null”
Output:
2021-03-31 20:58:37.100 [INFO ] [penhab.core.model.script.Flag_System] - executeCommandLine output null