On Fri 06 Jan 2017 at 22:00:45 (+0100), solitone wrote: > On Thursday, January 5, 2017 7:52:20 PM CET David Wright wrote: > > Do you perhaps need > > > > xset -display <something> dpms force on > > > > in the systemd script? > > no, I've also tried with the -display option, but I don't get anything, with > that command in either the pre block or the post block. > > BTW, on my system the -display option doesn't seem to be needed, because if I > do: > > $ sleep 1; xset dpms force off; sleep 2; xset dpms force on > > in a terminal, the screen switches off and on as expected.
Yes, but in your terminal, you'll probably find that $ echo $DISPLAY will give you :0 (locally) or localhost:10.0 (if you ssh into another computer). So your terminal's xset command will be happy without -display as it's got $DISPLAY instead. $ xset c 99 # good $ xset c 1 # good $ xset -display :1 c 99 # bad xset: unable to open display ":1" $ DISPLAY="" xset c 99 # bad xset: unable to open display "" $ DISPLAY="" xset -display :0 c 99 # good $ I'm assuming that a systemd command that suddenly pops up from nowhere will not have a suitable value for $DISPLAY. If I put * * * * * /usr/bin/xeyes into my crontab, I get an error message mailed to me every minute as above. If I replace it with * * * * * DISPLAY=":0" /usr/bin/xeyes I get a new pair of eyes popping up on the screen every minute. Cheers, David.