Page 1 of 1

Need help with a script [solved]

Posted: Saturday 09 July 2016 9:56
by Hokkie001
Good morning,

Who can help me with a script? The following script , I saved as a .py file and added my scripts folder with the correct permissions. But if I want to run scripts from terminal ( for testing ), I just get errors (syntax ) . I used the Text Editor (plain text) , TextWrangler . Nothing helps .

Code: Select all

#!/bin/sh

#Used to generate filename
today=`/bin/date '+%d-%m-%Y__%H-%M-%S'`;

#Get Snapshot from camera
wget "http://admin:[email protected]:80/image/jpeg.cgi" -O /home/pi/domoticz/tmp/zolder-$today.jpeg

#Send telegram with snapshot
curl -X POST "https://api.telegram.org/botXXXXXXXXXXXXXXXXXXXX/sendPhoto" -F chat_id=-XXXXXXXXXXXXXX -F photo="@/home/pi/domoticz/tmp/zolder-$today.jpeg"

#Delete previous taken snapshots older than 7 days
find /home/pi/domoticz/tmp/ -name '*.jpeg' -mtime +7 -delete
Thnx!

Re: Need help with a script

Posted: Saturday 09 July 2016 10:04
by jannl
According to the first line it is a shell script .sh onstead of a python script .py. Not sure if that is the error. Please correct and post the error here.

Re: Need help with a script

Posted: Saturday 09 July 2016 10:27
by Hokkie001
jannl wrote:According to the first line it is a shell script .sh onstead of a python script .py. Not sure if that is the error. Please correct and post the error here.
I'm a complete idiot :(

It's working now!

Thumbs up for your help!!