I need a cronjob with criteria to power on/off a TV on the basis:
Mon-Fri, power on the screen at 07.00 and power off the screen 17.00. Friday after 17.00 to Monday morning to be powered off.
I'm using xset
to force dpms on/off.
DISPLAY=:0 xset dpms force off
(powers off the TV)
DISPLAY=:0 xset dpms force on && DISPLAY=:0 xset s reset
(powers on the TV)
xset: /usr/bin/xset
Well first I'd move your turn on/off logic into scripts:
Contents of
/usr/local/bin/tv-turnon
:Contents of
/usr/local/bin/tv-turnoff
:Make them runable
And then setup cron to run them according to your schedule
crontab -e
(this will run in
vi
by default, if you're not familiari
to start inserting text:wq
to save and exit)You have to add the following entries in your crontab file:
To add a new entry in your crontab file, use the following command:
More about: http://en.wikipedia.org/wiki/Cron