To lock the screen, you can follow the answer to this post.
So you would write a script (in GEdit) containing:
#!/bin/sh
#: filename: lock-script
export DISPLAY=:0.0
gnome-screensaver-command -l
and save it in your home folder (or you could create a new directory for it).
If you only one to black out your display (without locking) change the -l
switch for -a
.
Make your script executable running chmod 744 /home/your-username/lock-script
.
Then execute the following
echo '15 * * * * /home/your-username/lock-script' | crontab
Now lock-script
will be executed 15 minutes after the start of every hour on every day. (At 01:15 pm
, then at 02:15 pm
, and so on.)
If you want more information about how to specify the period of time, you should check here.
BTW, for creating the crontab
line you could install gnome-schedule
which is a GUI frontend for this.
Hope it helps you!