Every 2 Minutes cronjob

Morrie Wyatt morrie at morrie.id.au
Thu Dec 22 20:41:48 AEDT 2016


Hi David.

Unfortunately it's more than just $DISPLAY that's involved.
These days, X is a bit more cautious about who is authorised
to access the display.

You don't want any user of your PC (or other external users)
to have unfettered access to your screen.

You could try adding "XAUTHORITY=/home/dz/.Xauthority" to your
script to define the appropriate "MIT-MAGIC-COOKIE".

This means of course that if you happen to be logged in as
a different user, the script won't work because the cookie
would not match that being used by the current user.

I just tried it here at the office, and it seems to do the
trick.

(man xauth)

I hope this works for you.

Regards,
Morrie.

-----Original Message-----
From: David Zuccaro [mailto:david.zuccaro at optusnet.com.au] 
Sent: Thursday, 22 December 2016 7:13 PM
To: Morrie Wyatt; luv-main at luv.asn.au
Subject: Re: Every 2 Minutes cronjob

On 22/12/16 18:57, Morrie Wyatt via luv-main wrote:
> Or add "> /tmp/scap.debug 2>&1" to the end of your crontab line
> to capture any outout and error messages.



I captured the error output and got:

 > No protocol specified
 > giblib error: Can't open X display. It *is* running, yeah?

This is what scap does:
#!/bin/sh

DISPLAY=:0 /usr/bin/scrot 'scap-%Y-%m-%d-%H:%M.jpg' -q 70 -e 'mv $f 
/home/dz/shots/; chown dz.dz /home/dz/shots/$f' > /tmp/scap.debug 2>&1

Yes it's a screen capture script.

Am I setting DISPLAY properly?

Thanks

David



More information about the luv-main mailing list