Dom0 screencapture with cron

51 views
Skip to first unread message

hoff...@gmail.com

unread,
Nov 28, 2019, 12:06:33 AM11/28/19
to qubes-users
I would liek to set a cron job that captures a shot of my whole screen. 

I have this script in cron.hourly, but it doesn't work.

#!/bin/bash
date=$((date '+%H%M%S))
import -window root /home/user/$date.png

If I run 
$ import -window root /path/to/folder/screen.png
as a user in dom0, then it works fine.

Any suggestions? I think it has something to do with root not being able to access the full screen???
Thanks so much for any help,
Arild

David W. Hodgins

unread,
Nov 28, 2019, 2:11:05 AM11/28/19
to qubes...@googlegroups.com
Try replacing the command in the cron script, which runs as root with ...
su --login user -c "import -window root /home/user/$date.png"

Regards, Dave Hodgins

M

unread,
Nov 28, 2019, 7:59:56 AM11/28/19
to qubes-users
May I ask why you would like to take pictures of the whole screen every hour or so... ?

For me it sounds like something that could be used for surveillance (which Qubes OS is made to prevent) if the script is imported into another Qubes OS dom0. Although it probably would require an accept from the user.

Or am I just paranoid... ?

hoff...@gmail.com

unread,
Nov 28, 2019, 12:13:22 PM11/28/19
to qubes-users
I'm just running through some ideas. Something every hour is a little much, but I would like to take a screenshot of the whole window after a script is run. Still the same question.
If I use su --login user -c, it prompts for a password. I'd like it to take a screenshot in the background without a need for the password.
Thanks

tetra...@danwin1210.me

unread,
Dec 9, 2019, 6:09:17 AM12/9/19
to hoff...@gmail.com, qubes-users
On Thu, Nov 28, 2019 at 09:13:22AM -0800, hoff...@gmail.com wrote:
>I'm just running through some ideas. Something every hour is a little much,
>but I would like to take a screenshot of the whole window after a script is
>run. Still the same question.

It's not quite capturing screenshots, but here's a quick script I use to
keep track of what I'm doing at regular intervals, logging the current
time and active window name to a log file:

#!/bin/bash
TZ='UTC-0'; export TZ
LOGFILE="time.log"
INTERVAL=300 # 5 minutes
{
while :
do
date
xdotool getwindowname $(xdotool getactivewindow)
sleep $INTERVAL
done
} | tee $LOGFILE

Reply all
Reply to author
Forward
0 new messages