Need help with a script [solved]

Moderator: leecollings

Post Reply
Hokkie001
Posts: 4
Joined: Monday 27 June 2016 23:21
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Need help with a script [solved]

Post 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!
Last edited by Hokkie001 on Saturday 09 July 2016 10:33, edited 1 time in total.
jannl
Posts: 625
Joined: Thursday 02 October 2014 6:36
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.2
Location: Geleen
Contact:

Re: Need help with a script

Post 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.
Hokkie001
Posts: 4
Joined: Monday 27 June 2016 23:21
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Need help with a script

Post 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!!
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests