script to take screenshot every hour

Moderator: leecollings

Post Reply
judaca
Posts: 8
Joined: Saturday 09 March 2019 9:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

script to take screenshot every hour

Post by judaca »

Hello, can anyone help me ? I have a (working) Bash Shell Script to take a snapshot of an ONVIF camera. When i launch te script
at the command prompt in using "bash script.sh" it works perfect and saves the picture in the specified directory as photo.jpg with
as owner "pi" and rights "rwxr-xr-x" what is perfect for me !

To run the script every hour in Domoticz i call the script.sh using a Blocky script or dzVents script (i tried both). This also works, but
the wile is saved in de specified directory with other rights and owner !! Owner is "root" and permissions "rw-r-----". So i can't copy them,
can't change te permissions etc....

Anybody knows what the reason for this is or how i can solve this ?
User avatar
breizhcat
Posts: 16
Joined: Tuesday 07 July 2020 17:51
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: France
Contact:

Re: script to take screenshot every hour

Post by breizhcat »

Hi

I guess that the user used by domoticz to run is root. You can change the rights at the end of your scripts and the owner too with chmod and chown.


Btw, is it possible to share your script i'm interested by this idea.

Thanks

Envoyé de mon Mi 9T Pro en utilisant Tapatalk


judaca
Posts: 8
Joined: Saturday 09 March 2019 9:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: script to take screenshot every hour

Post by judaca »

This is the code i use in the bash script :

Code: Select all

#!/bin/sh
export DATETIME=`date +%Y%m%d%H%M%S`
ffmpeg -loglevel fatal -i rtsp://192.168.1.19:554/user=admin_password=tlJwpbo6_channel=1_stream=0.sdp?real_stream -vframes 1 -r 1 /home/pi/Pictures/$DATETIME.jpg
Can you help me how i can change the owner and permissions ? What do i have to add ? I'm a "newbie"
Last edited by judaca on Tuesday 07 July 2020 20:07, edited 2 times in total.
User avatar
breizhcat
Posts: 16
Joined: Tuesday 07 July 2020 17:51
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: France
Contact:

Re: script to take screenshot every hour

Post by breizhcat »

Thanks I will test it with my cameras

Envoyé de mon Mi 9T Pro en utilisant Tapatalk

judaca
Posts: 8
Joined: Saturday 09 March 2019 9:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: script to take screenshot every hour

Post by judaca »

can you tell me what i need to change or add ?
User avatar
breizhcat
Posts: 16
Joined: Tuesday 07 July 2020 17:51
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: France
Contact:

Re: script to take screenshot every hour

Post by breizhcat »

For me you have to add these 2 lines. 1st allow you to change the owner of the file and 2nd change the auth on the file.

Code: Select all

chown user:group your_file
chmod 755 your_file


Envoyé de mon Mi 9T Pro en utilisant Tapatalk


judaca
Posts: 8
Joined: Saturday 09 March 2019 9:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: script to take screenshot every hour

Post by judaca »

Thanks ! It works now !
judaca
Posts: 8
Joined: Saturday 09 March 2019 9:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: script to take screenshot every hour

Post by judaca »

BTW how do you do that to set code in a window here on forum like you did with the things i need to ad ?
User avatar
breizhcat
Posts: 16
Joined: Tuesday 07 July 2020 17:51
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: France
Contact:

Re: script to take screenshot every hour

Post by breizhcat »

With the bbcode like xml tag but between [. You have to open the tag code put your code and close it.

Envoyé de mon Mi 9T Pro en utilisant Tapatalk

User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: script to take screenshot every hour

Post by waaren »

judaca wrote: Tuesday 07 July 2020 18:25 BTW how do you do that to set code in a window here on forum like you did with the things i need to ad ?
By using the button
code button.PNG
code button.PNG (37.32 KiB) Viewed 1230 times
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest