Action On Bash Scripts return -1
Posted: Wednesday 04 May 2016 14:18
Having trouble running an on action script. It started when the cpu temp from my raspberry stopped showing data in domoticz. So why not write a script to fix this manually and learn a bit of domoticz inner workings. To test and debug the script at first it was coupled to a switch to run at action on. That did not work as expected which send me on a this quest.
The script runs fine from a bash terminal and also when called by cron there is no problem. It's not the contents of the script, any script tried so far gives the same result. I read a lot of action on problems on the forum which gave me a lot of insight but none of them solves my problem. Since the error codes are consistent for all tried scripts there must be something I am overlooking. There are other ways to get this done, the original cpu temp script runs fine using cron, but I want to understand why action on script:// is not working.
This is a simple script that produces the same result.
The script is located in:
It has the right file mode (755) and default pi account ownership. Hence no problem running it from a terminal or cron.
In the domoticz web interface it is configured in the on action of a switch.
When the switch is switched on the log says it is executing but returns an error. I looked but can't find what the return code means. The path and filename are correct.
Is there somebody here who knows what going wrong?
The script runs fine from a bash terminal and also when called by cron there is no problem. It's not the contents of the script, any script tried so far gives the same result. I read a lot of action on problems on the forum which gave me a lot of insight but none of them solves my problem. Since the error codes are consistent for all tried scripts there must be something I am overlooking. There are other ways to get this done, the original cpu temp script runs fine using cron, but I want to understand why action on script:// is not working.
This is a simple script that produces the same result.
Code: Select all
#!/bin/bash
echo "hello" >> /home/pi/domoticz/scripts/bash/test.log &
Code: Select all
/home/pi/domoticz/scripts/bash/tems2.sh
In the domoticz web interface it is configured in the on action of a switch.
Code: Select all
script:///home/pi/domoticz/scripts/bash/tems2.sh
Code: Select all
2016-05-04 12:38:58.899 User: Admin initiated a switch command
2016-05-04 12:38:58.901 (RFXtrx433 ) Lighting 2 (Schemerlamp Tafel)
2016-05-04 12:38:59.149 Executing script: /home/pi/domoticz/scripts/bash/tems2.sh
2016-05-04 12:38:59.149 Error: Error executing script command (/home/pi/domoticz/scripts/bash/tems2.sh). returned: -1