#! /bin/sh # If X isn't running, get out of here now. # We can't merely check the DISPLAY env variable because this script # runs on a cron job, not below where X was started. #if ps -U $USER | grep -q Xorg #then # exit #fi DEFAULT_DISPLAY=":0.0" CMD_STRING="xset +dpms" # Send messages to stdout tagged as originating from this script. msg () { echo "$(basename $0): $1" } # It all starts here if [ -n "$*" ] then msg "Running command(s) now" $* msg "Command(s) finished, sleeping now..." sleep 1 fi if [ -z "$DISPLAY" ] then msg "No DISPLAY variable, using a reasonable default: $DEFAULT_DISPLAY" msg "Re-enabling dpms now" DISPLAY=$DEFAULT_DISPLAY $CMD_STRING else msg "Re-enabling dpms now" $CMD_STRING fi