Control screen from CLI (crontab)


#!/bin/bash
export DISPLAY=:0.0

if [ $# -eq 0 ]; then
echo usage: $(basename $0) “on|off|status”
exit 1
fi

if [ $1 = “off” ]; then
echo -en “Turning monitor off…”
xset dpms force off
echo -en “done.\nCheck:”
xset -q|grep “Monitor is”
elif [ $1 = “on” ]; then
echo -en “Turning monitor on…”
xset dpms force on
echo -en “done.\nCheck:”
xset -q|grep “Monitor is”
elif [ $1 = “status” ]; then
xset -q|sed -ne ‘s/^[ ]*Monitor is //p’
else
echo usage: $(basename $0) “on|off|status”
fi


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *