I want to turn off monitor on a specific period of time automatically (for example between 07:00 and 11:00). Is there any command to be set in crontab file? Is there any better way?
In summary:
Turning off the monitor at 07:00 automatically.
Turning on the monitor at 11:00 automatically.
- scren-saver & lock screen are disabled!
Assuming that you are using the default gnome-screensaver for Ubuntu, open a terminal and run next commands followed by instructions:
mkdir -p bin
- this command will make abin
directory in yourhome
folder if you don't already have it.gedit ~/bin/screen_on_or_off.sh
- this will create the new filescreen_on_or_off.sh
in gedit.Copy and paste the next script:
Save the file and close it.
chmod +x screen_on_or_off.sh
- to grant execute access for the script.~/bin/screen_on_or_off.sh
.Edit the crontab entries using
crontab -e
command (by default this will edit the current logged-in users crontab) and add the following line:I have set the cron job for every minute, but you can change as you wish or as you think is better. See http://en.wikipedia.org/wiki/Cron in this sense.
crontab -l
.Now your screen will turn off every day between 7 and 11.
Newer and much simpler answer, put this in cron: