I’m trying to run an script file from an executeCommandLine in my OpenHAB rules. The log shows that it saw the push button and executed the command, but I don’t think it’s actually running the shell script. Here’s what I have:
rule "frm_off_rule" when Item itm_frm_off received update then executeCommandLine("/home/pi/scripts/run_test.sh") end
The <run_test.sh> looks like this:
pi@raspberrypi:~/scripts $ cat run_test.sh mosquitto_pub -h localhost -t 'teststart' -m '1'
I’ve tried running the script file and I do indeed see the MQTT publish, so there’s nothing wrong with the script.
I see the log file trying to execute the script
2018-04-16 11:45:52.451 [INFO ] [lipse.smarthome.io.net.exec.ExecUtil] - executed commandLine ‘bash /home/pi/scripts/run_test.sh’
I’ve tried adding sudo in a few places - in the script before the mosquitto_sub, and also adding it inside the executeCommandLine itself. I’ve tried adding bash in the command too.
executeCommandLine("sudo /home/pi/scripts/run_test.sh") executeCommandLine("bash /home/pi/scripts/run_test.sh")
But that doesn’t help. I have another Pi running Raspbian that uses the same setup, and that one works. Looking through the forum posts, this seems to happen, but it’s a mystery why it happens. Any tips?