Score:0

shutter is not working as a cron job for taking screenshot

ms flag

My requirement is to capture the screen shot of the desktop's users, Using the following script, but It is not working. Regardless of which user logged in,this script is running as cron job in root permission, should take print out.

mkdir -p /root/shots
#xhost +si:localuser:root
export DISPLAY=:0
shutter -f -o '/root/shots/myshot-%y-%m-%d_%T.jpg' -e >> /root/shots/logs 2>&1
find /root/shots/ -type f -name ".*jpg" -mtime +10 -exec rm {} \;
date >> /root/shots/logs

Note: There is a similar question in the same forum, But those are running as a normal user permission. It works as a normal user in cronjob, not working as a root user.

Edit: The command to run a cronjob

* * * * *  /bin/bash /root/shots/shutter.sh

The following errors are there in the log file

No protocol specified
Gtk-WARNING **: cannot open display: :0 at /usr/lib/x86_64-linux-gnu/perl5/5.26/Gtk2.pm line 126.
David avatar
cn flag
What is the command you are using to run the cron job?
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.