Page 1 of 1

script to take screenshot every hour

Posted: Tuesday 07 July 2020 17:31
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 ?

Re: script to take screenshot every hour

Posted: Tuesday 07 July 2020 17:57
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



Re: script to take screenshot every hour

Posted: Tuesday 07 July 2020 18:05
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"

Re: script to take screenshot every hour

Posted: Tuesday 07 July 2020 18:06
by breizhcat
Thanks I will test it with my cameras

Envoyé de mon Mi 9T Pro en utilisant Tapatalk


Re: script to take screenshot every hour

Posted: Tuesday 07 July 2020 18:09
by judaca
can you tell me what i need to change or add ?

Re: script to take screenshot every hour

Posted: Tuesday 07 July 2020 18:14
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



Re: script to take screenshot every hour

Posted: Tuesday 07 July 2020 18:23
by judaca
Thanks ! It works now !

Re: script to take screenshot every hour

Posted: Tuesday 07 July 2020 18:25
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 ?

Re: script to take screenshot every hour

Posted: Tuesday 07 July 2020 18:28
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


Re: script to take screenshot every hour

Posted: Tuesday 07 July 2020 18:34
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 1235 times