Original Poster: Gagarin Gambit
With cron you can configure your linux installation to perform various jobs at specific times and dates. This feature is usually used by servers, but even the casual user can take advantage of it to automate some routine work or add some nice effects. Here I'll illustrate how you can take advantage of it by a simple example: making your computer ring the hours like a grandfather clock.
Cron is included in any fresh PCLinuxOS installation, however it's only available to the root user. So the first thing you need to do is allow your user to access it. There are two ways to do this:
First you can open the terminal as super user and type
# echo [your user name] > /etc/crontab.allow
Repeat if you want to add more users.
The other way is to open konqueror as super user, create a text file named "cron.allow" in /etc, and then type the name of your user in the file (that's what the above command does). If you want to include multiple users, use a separate line for each one.
Then you have to create a crontab file for your user and input your commands. Note that each user has his/her own file. Again, you can do this through the terminal or through a text editor.
Terminal
The commands for cron are these:
crontab -l: view your current crontab
crontab -r: delete your crontab
crontab -e: edit your crontab
crontab [filepath]: replace your crontab with the specified file
To create your crontab file you have to use the crontab -e command. This will take you to a vi editor, with which it's likely you're not familiar. This page illustrates how to use vi; for basic usage you need to know that [insert] or i enters edit mode, [escape] exits it, :w saves your changes, :q quits. Any changes you did will be saved in a text file named after your user in /var/spool/cron.
Text editing
You can create this file yourself if you open konqueror as super user. It must be named like your user and located in the path mentioned above. This way you can edit your crontab in KWrite and avoid the vi editor - but in this case you should be careful not to make any mistakes, because KWrite will not point them out as the vi editor would. Alternatively you can create the file in your home directory and use the command crontab [filepath].
All right, but how does cron work?
The syntax has this format:
minute[0-59] hour[0-23] day of month[1-31] month [1-12] day of week [1-7] command
You can specify multiple values by seperating them with a comma. If you don't want to specify a value for a field, you can enter an asterisk.
Example:
01 20 1,15 * * ktorrent - will open KTorrent at 8:01 pm at the 1st and 15th of every month
0 4 * * 7 ktorrent - will open KTorrent at 4 am every Sunday.
If both the day of month and the day of week is specified, the command will be executed when either of the events happen.
Of course it's pointless to use crontab to open or quit ktorrent (unless perhaps you want to seed at specific times). Let's see then how we can make the computer sound like a grandfather clock.
I have uploaded some sounds for you at <a href="
http://rapidshare.com/files/206183089/Clocksounds.zip" target="_blank">rapidshare[/url] to get you started. Supposing you extract them in your home folder, you need to input these lines in your crontab file (using either crontab -e or a text editor, whatever suits you):
0 1,13 * * * aplay /home/[user name]/1oclock.wav
0 2,14 * * * aplay /home/[user name]/2oclock.wav
0 3,15 * * * aplay /home/[user name]3oclock.wav
0 4,16 * * * aplay /home/[user name]/4oclock.wav
0 5,17 * * * aplay /home/[user name]/5oclock.wav
0 6,18 * * * aplay /home/[user name]/6oclock.wav
0 7,19 * * * aplay /home/[user name]/7oclock.wav
0 8,20 * * * aplay /home/[user name]/8oclock.wav
0 9,21 * * * aplay /home/[user name]/9oclock.wav
0 10,22 * * * aplay /home/[user name]/10oclock.wav
0 11,23 * * * aplay /home/[user name]/11oclock.wav
0 12,0 * * * aplay /home/[user name]/12oclock.wav
30 * * * * aplay /home/[user name]/1oclock.wav
As you can understand, your computer will play the specified sounds at the specific times. For example the second line means that the computer will play the 2oclock.wav sound in your home folder every day at 2:00 and 14:00 (which consists of two bell sounds), while the last line means it will play 1oclock.wav (one bell sound) at every half hour.
You'd better reboot to make sure that your changes will take effect.
If you're interested in this specific effect, I found some very nice samples from known clocks around the world here, which you can modify with a program like Audacity. You can also try a program like festival to announce the time.
And a few hints for writing your own commands.
Don't use commands that drain the resources of your system, for this can cause much frustration.
Test your command in the terminal first, to make sure it works as you want it to.
Don't use any command that might interfere with your pclinuxos installation, unless you're really sure what you're doing.
Of course this is only a very simple application of crontab. Note that you can also use it to execute a script instead of a terminal command, if you want to do more complicated things. For example you can write (or find on the net) a python script executing a backup of your important files weekly, or another to automatically download the latest photos from your favorite site. With a little skill and creativity, the possibilities are endless.
There are many pages on the internet teaching how to use cron in detail; if you want to know more, I recommend this:
http://unixgeeks.org/security/newbie/unix/cron-1.htmlNote that personally I only recently learned how to use cron, so any comments or corrections from more experienced users are welcome.
Edit: by O-P to add back link to clock tones at rapidshare.