screensaver or APM control via commandline?
Charles Jones
charles.jones at ciscolearning.org
Mon Mar 2 17:52:10 MST 2009
Matt Graham wrote:
>> xset dpms force off # to turn off
>>
>> This worked from a shell, I don't know if it will work in cron
>>
>
> At the very least, you need to set DISPLAY to :0 , as cron jobs have
> a really limited set of environment variables. The cron job also
> must be running as the user who's currently using the X Display.
> Or you could just do "xhost +local:", though that will cause paranoid
> people to have a cow.
>
Yep I figured that out as well. Here is what I am using for tonight, I
will come up with a more graceful script tommorrow :-)
[bigscreen at bigscreen ~]$ cat /usr/local/bin/display.sh
#!/bin/bash
export DISPLAY=:0.0
PARAM=$1
if [ "off" == "$PARAM" ]; then
echo "Turning OFF screen via dpms..."
export DISPLAY=":0.0"
/usr/bin/xset dpms force off
exit 0
elif [ "on" == "$PARAM" ]; then
echo "Turning ON screen via dpms..."
export DISPLAY=":0.0"
/usr/bin/xset dpms force on
exit 0
fi
echo "Usage: $0 on/off"
echo " This will turn the display on or off via dpms."
I tested this from cron as the user running the X session and it appears
to work :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.PLUG.phoenix.az.us/pipermail/plug-discuss/attachments/20090302/183746b8/attachment.htm
More information about the PLUG-discuss
mailing list