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 :-)

[bigscr...@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 :)
---------------------------------------------------
PLUG-discuss mailing list - PLUG-discuss@lists.plug.phoenix.az.us
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss

Reply via email to