os.execute: syntax for mqtt command in sh script ?
Posted: Friday 04 October 2019 17:52
I have a LED strip with Tasmota, all integrated in domoticz.
Trying to see if I could make a sh script that would run my own sequence of lights (I'd call the script from a switch with & )
In lua, in domoticz Events, I can issue
and it works
On the command line of the pi (ssh), I can issue
and it also works
however, if I try to put the above or variations thereof into a sh script, I get failure
something in the syntax.. I spent a little while on this, and can't figure it out. Probably a combination of " and '...
For ex with code
then I get
Who can tell me what I'm doing wrong ? thanks !
Trying to see if I could make a sh script that would run my own sequence of lights (I'd call the script from a switch with & )
In lua, in domoticz Events, I can issue
Code: Select all
os.execute('mosquitto_pub -h 127.0.0.1 -u xxx -P xxx -t cmnd/LEDLightStrip/Power -m on')
On the command line of the pi (ssh), I can issue
Code: Select all
mosquitto_pub -h 127.0.0.1 -u xxx -P xxx -t cmnd/LEDLightStrip/Power -m on
however, if I try to put the above or variations thereof into a sh script, I get failure
something in the syntax.. I spent a little while on this, and can't figure it out. Probably a combination of " and '...
For ex with code
Code: Select all
#!/bin/bash
os.execute('mosquitto_pub -h "127.0.0.1" -u "xxx" -P "xxx" -t "cmnd/LEDLightStrip/Power" -m "on"')
Code: Select all
~/domoticz/scripts $ ./zzTestScript.sh
./zzTestScript.sh: line 2: syntax error near unexpected token `'mosquitto_pub -h "127.0.0.1" -u "xxx" -P "xxx" -t "cmnd/LEDLightStrip/Power" -m "on"''