Page 1 of 1

Can execute script from putty but not from domoticz

Posted: Monday 15 February 2016 18:04
by burton666
I have placed a script in the /script folder and have verified that it works by running ./script.sh.
But I can't get it to work from domoticz.

Code: Select all

Executing script: /home/pi/domoticz/scripts/datorrum_toggle.sh
Error: Error executing script command (/home/pi/domoticz/scripts/datorrum_toggle.sh). returned: 32512
This is what I have tried under the script option: script://home/pi/domoticz/scripts/datorrum_toggle.sh and also script://datorrum_toggle.sh

Re: Can execute script from putty but not from domoticz

Posted: Monday 15 February 2016 18:09
by Sneezydevil
You might need 3 slashes.

Code: Select all

script:///home/pi/domoticz/scripts/datorrum_toggle.sh
Was an update at some point I think.

Re: Can execute script from putty but not from domoticz

Posted: Monday 15 February 2016 18:28
by burton666
That did not work either.

when I run ls -l every script is "owned" by "pi" but the script I am trying to run looks like this:

Code: Select all

-rwxrwxrwx 1 root root    83 Feb 15 18:24 datorrum_toggle.sh

Re: Can execute script from putty but not from domoticz

Posted: Monday 15 February 2016 18:33
by burton666
this is the script:

Code: Select all


#!/bin/bash

sudo ./wemo_control.sh 192.168.0.200 LINK datorrum TOGGLE  > /dev/null

Re: Can execute script from putty but not from domoticz

Posted: Monday 15 February 2016 18:38
by Sneezydevil
Try using the entire path in the script like:

Code: Select all

/home/pi/domoticz/scripts/wemo_control.sh
And doesnt sudo ask for a password? I login on so many different stations I can't remember default behavior for a pi.

Re: Can execute script from putty but not from domoticz

Posted: Monday 15 February 2016 18:51
by burton666
Tried that to without success.

I chaged the path in the script to ~/domoticz/scripts/wemo_control.sh
and I am able to run it by ./datorrum_toggle.sh or ~/domoticz/scripts/datorrum_toggle.sh. everything works fine in putty but nothing works from domoticz.

When I run sudo it does not ask for password

Re: Can execute script from putty but not from domoticz

Posted: Monday 15 February 2016 19:17
by burton666
I logged in to root by sudo su and if I run the same script from there I get:

Code: Select all

root@raspberrypi:/home/pi/domoticz/scripts# ./datorrum_toggle.sh
./datorrum_toggle.sh: line 3: ./home/pi/domoticz/scripts/wemo_control.sh: No such file or directory

Re: Can execute script from putty but not from domoticz

Posted: Monday 15 February 2016 19:34
by Westcott
I don't think that './home/pi/domoticz/scripts/wemo_control.sh' should start with a dot.

Re: Can execute script from putty but not from domoticz

Posted: Monday 15 February 2016 19:36
by burton666
I removed the dot in the beginning of the script and it then worked.

Code: Select all

#!/bin/bash

/home/pi/domoticz/scripts/wemo_control.sh 192.168.0.200 LINK datorrum TOGGLE  > /dev/null