Help needed on Script Running from Domoticz: returned: 32512

On various Hardware and OS systems: pi / windows / routers / nas, etc
Post Reply
edwindred
Posts: 20
Joined: Friday 27 May 2016 17:52
Target OS: -
Domoticz version:
Contact:

Help needed on Script Running from Domoticz: returned: 32512

Post by edwindred » Sunday 23 September 2018 11:46

Hello,

I am going crazy here, i've been struggling to get a script running from domoticz. I've been searching on this and other forums for a more than a day now, and I can't find the solution.

The script itself is running perfectly on command line. I made sure the owner and permissions are set to root.

For testing purposes , i've created a quite empty script called test.sh to see if that can be run correct, but it is running into the same errors.

Domoticz log:
2018-09-23 10:52:57.733 Error: Error executing script command (/home/pi/domoticz/scripts/test.sh#). returned: 32512

The script:<br/>
root@DomoControllerRPI3:/home/pi/domoticz/scripts# ls -l
-rwxrwxrwx 1 root root 177 Sep 23 10:44 test.sh


The reduced script:

Code: Select all

#!/bin/sh
LOGFILE=/home/pi/camerasnapshot.log
today=`/bin/date '+%d-%m-%Y__%H-%M-%S'`;    #Used to generate filename
echo Test.sh has been executed $today |tee -a $LOGFILE
The logfile:
root@DomoControllerRPI3:/home/pi# ls -l
-rwxrwxrwx 1 root root 4321 Sep 23 10:44 camerasnapshot.log


The blockly script call:
blockyscriptcall.JPG
blockyscriptcall.JPG (26.09 KiB) Viewed 269 times
When i add a space and & it seems to work and domoticz executes the script.
blockyscriptcallwithamp.JPG
blockyscriptcallwithamp.JPG (21.44 KiB) Viewed 267 times
2018-09-23 11:21:56.573 Status: Executing script: /home/pi/domoticz/scripts/test.sh &#[/b]

Then i tried to rebuild the script
The script will work until it needs to call the mailx command. to mail the attachments. I want to use mailx because I need multiple attachments to be sent as part of a security script. the script below seems to work now until the mailx command. I have a camerasnapshot in the correct location.

Code: Select all

#!/bin/sh

LOGFILE=/home/pi/camerasnapshot.log
today=`/bin/date '+%d-%m-%Y__%H-%M-%S'`;    #Used to generate filename
echo Test.sh has been executed $today |tee -a $LOGFILE

IP="192.168.2.201" # IP address Camera echo $IP $today |tee -a $LOGFILE
# Ping IP-address of camera to see if it's online, otherwise we don't have to grab a snapshot
if ping -c 1 $IP > /dev/null ; then #Grab snapshot
echo camera online |tee -a $LOGFILE

#Get Snapshot from camera
wget "http://192.168.2.201:88/cgi-bin/CGIProxy.fcgi?cmd=snapPicture2&usr=user&pwd=pass" -O /home/pi/Camera_Snapshots/WoonkamerCamera.jpeg

#echo start sending mail $today |tee -a $LOGFILE
echo "Beweging geconstateerd in de Woonkamer" | mailx -A gmail -s "Beweging in Woonkamer" mailuser@gmail.com

else
echo camera onbereikbaar |tee -a $LOGFILE
fi
when i try to access the mailx command as root i get:
root@DomoControllerRPI3:/etc# mailx
No mail for root

When I run the script from CLI as root, its working perfectly:

Code: Select all

root@DomoControllerRPI3:/home/pi/domoticz/scripts# ./test.sh
Test.sh has been executed 23-09-2018__11-38-26
camera online
--2018-09-23 11:38:26--  http://192.168.2.201:88/cgi-bin/CGIProxy.fcgi?cmd=snapPicture2&usr=user&pwd=password
Connecting to 192.168.2.201:88... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/plain]
Saving to: ‘/home/pi/Camera_Snapshots/WoonkamerCamera.jpeg’

/home/pi/Camera_Snapshots/WoonkamerCamera.jpeg                  [ <=>                                                                                                                                       ]      51  --.-KB/s   in 0s

2018-09-23 11:38:26 (434 KB/s) - ‘/home/pi/Camera_Snapshots/WoonkamerCamera.jpeg’ saved [51]

root@DomoControllerRPI3:/home/pi/domoticz/scripts#


I am at a complete loss here.
What am i missing? additional permissions needed for mailx and if so where should i set those?
Any help is appreciated
Attachments
blockyscriptcallwithamp.JPG
blockyscriptcallwithamp.JPG (21.44 KiB) Viewed 269 times

edwindred
Posts: 20
Joined: Friday 27 May 2016 17:52
Target OS: -
Domoticz version:
Contact:

Re: Help needed on Script Running from Domoticz: returned: 32512

Post by edwindred » Monday 24 September 2018 19:06

Running below command sends an email as well.
Therefor I would say that the Mailx permissions are ok?

root@DomoControllerRPI3:/home/pi/domoticz/scripts# echo -e "Mail body text" | mailx -A gmail -s "Mail subject" xxxx@gmail.com

edwindred
Posts: 20
Joined: Friday 27 May 2016 17:52
Target OS: -
Domoticz version:
Contact:

Re: Help needed on Script Running from Domoticz: returned: 32512

Post by edwindred » Thursday 27 September 2018 20:14

seems sendmail and ssmtp were conflicting or something like that
removed sendmail completely,
reinstalled ssmtp and heilroom-mailx and mailutils
removed the -A gmail

now got it working with below command in blockly script call:
///home/pi/domoticz/scripts/script.sh &

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests