Command Line Tools
There are two main tools used to perform scheduled tasks, at and cron. You may also like to try anacron if your computer does not run continuously, as cron will only work if your computer is left on (anacron can catch up with the scheduled tasks the next time the computer is on...).
at now + time
at -f shell_script now + 1 hour
Anacron: anacron is another tool designed for systems which are not always on, such as home computers
While cron will not run if the computer is off, anacron will simply run the command when the computer is next on (it catches up with things).
day of month
1-12 (or names, see below)
day of week
0-7 (0 or 7 is Sun, or use three letter names)
There are also a number of shortcut methods for common tasks, including:
@yearly --- same as 0 0 1 1 *
@annually --- same as @yearly
@monthly --- same as 0 0 1 * *
@weekly --- same as 0 0 * * 0
@daily --- same as 0 0 * * *
@midnight --- same as @daily
@hourly --- same as 0 * * * *
Step values can be used in conjunction with ranges. Following a range with ``/<number>'' specifies skips of the number's value through the range. For example, ``0-23/2'' can be used in the hours field to specify command execution every other hour (the alternative in the V7 standard is ``0,2,4,6,8,10,12,14,16,18,20,22''). Steps are also permitted after an asterisk, so if you want to say ``every two hours'', just use ``*/2''.
When writing a crontab entry you simply type in six fields separated by spaces, the first five are those listed in the table (using numbers or letters and numbers as appropriate), the 6th field is the command to be executed and any options, cron will read everything up until the newline.
5 4 * * sun echo "run at 5 after 4 every sunday"
This information has come from (without editing) a post on the LinuxChix techtalk mailing list, please see  in the Bibliography for further information.
This information comes from the cron manual page with small additions (no changes to original content), refer to  in the Bibliography for further information.
Leave a Reply
You must be logged in to post a comment.