Page 1 of 1

Script works in ssh but not in domoticz

Posted: Monday 07 March 2016 19:53
by codesnipper
I have python script relay.py - chmod 755, owner is pi, in scripts folder. In action i call it "script:///home/pi/domoticz/scripts/relay.py 1 1" and it not works. Error 512. When I put on first line "#!/usr/bin/python" error is changing to 32512.

In ssh works fine.

So I wrote scripts 10sh and 11.sh, owned to pi, chmoded 755, scripts code is one line:

python //home/pi/domoticz/scripts/python/relay.py 1 1

and

python //home/pi/domoticz/scripts/python/relay.py 1 0

and call it in action trigger - on: "python //home/pi/domoticz/scripts/11.sh", off: on: "python //home/pi/domoticz/scripts/11.sh"

It works. So where is the problem with execution .py file in action trigger?

Re: Script works in ssh but not in domoticz

Posted: Tuesday 08 March 2016 7:45
by Egregius
Why put 'python' in front of a bash script?
Why the double // in front of the path?
Anyway, a bash script in between is a good idea because you can add "> /dev/null 2>&1 &" at the end of the command. That way the bash script is instantly finished and Domoticz can continue with other stuff. Without that domoticz waits until the script is finished before doing anything else.

Re: Script works in ssh but not in domoticz

Posted: Tuesday 08 March 2016 10:33
by codesnipper
Thanks, I added it to sh script.

When I remove python or one dash script does not works.