From Knoppix Documentation Wiki
Revision as of 11:20, 6 September 2009 by Polymath69 (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Scheduling jobs on linux requires two parts. The first part is having the crond daemon running. The second part is using the crontab command to create a schedule. The schedule is a list of jobs with times that you'd like to have run.

There are two versions of the command that you will use most of the time.

crontab -e

To edit your crontab file.

crontab -l

To list your crontab file.

crontab -l > crontabbackup.txt

Another use of the -l switch allows you to send the schedule to a file.

crontab crontabbackup.txt

If you use the crontab -l option and send the output to a file as was shown in the prior command example, you can take that schedule and import it into another schedule. All you have to do is use crontab and supply your backed up schedule file. This is a great trick for knoppix. The creative use of this format of the command would be to import your schedule from a USB thumb drive or a hard drive partion. You could even store the file on a MS Windows partition as long as the file is in linux format versus MS-DOS format.

man 5 crontab

Use this man command to read about the formatting requirements for your crontab files.

Note: there are two main types of crontab -- each user's crontab located in the directory /var/spool/cron/crontabs/user, and the main system crontab /etc/crontab. The crontab -e command will edit only the per-user crontab files. Use sudo vi /etc/crontab to edit the systemwide crontab, but use this with caution or as a last resort as this command will bypass the syntax checking enforced by crontab -e.

External links