Script works in ssh but not in domoticz

Moderator: leecollings

Post Reply
codesnipper
Posts: 16
Joined: Tuesday 23 February 2016 14:04
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Script works in ssh but not in domoticz

Post 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?
User avatar
Egregius
Posts: 2592
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

Re: Script works in ssh but not in domoticz

Post 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.
codesnipper
Posts: 16
Joined: Tuesday 23 February 2016 14:04
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Script works in ssh but not in domoticz

Post by codesnipper »

Thanks, I added it to sh script.

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

Who is online

Users browsing this forum: No registered users and 1 guest