Hello,
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
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.
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?
How did you run the script? did you use ‘sh scriptname’ or ‘./scriptname’? The reason for asking is that the ‘sh’ method is tolerant of non-unix type files, whereas the direct execution mode isn’t. This usually happens when you’ve edited the script on a windows machine, and copied it to your Linux machine. If this is the case, you can use vim to fix it, with the command :set ff=unix.