epsilonhalbe
epsilonhalbe

Reputation: 15959

activating xscreensaver by cronjob

linux users,

could you tell me if and how i can activate xscreensaver by a cronjob? As background information i have to get off the pc every hour (for health reasons)- i thought it would be easiest to do this with cron.

50 * * * * /usr/bin/xscreensaver-command -activate

does not work as expected - syslog logs activity but i don't see one. i also wont get a terminator (terminal emulator) started. is there a way to start a gui/display program with cron ?

thanks in advance ε/2

Upvotes: 1

Views: 809

Answers (1)

bdonlan
bdonlan

Reputation: 231373

X applications require certain environment variables to be set, in order to point them to the right display. Try:

50 * * * * DISPLAY=:0 /usr/bin/xscreensaver-command -activate

If this doesn't work, you may need some sort of XAUTHORITY environment variable as well - check from within your GUI session to see if there's such a variable set, and replicate it here.

Upvotes: 4

Related Questions