Difference between revisions of "Crontab"


From Knoppix Documentation Wiki
Jump to: navigation, search
(elchil)
m (Reverted edits by 121.100.50.7 (Talk); changed back to last version by 78.143.200.245)
Line 1: Line 1:
dronlaacctr
 
 
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.
 
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.
  

Revision as of 05:33, 15 July 2008

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 useful variation of the -l, list your crontab, 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 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 verse MS Dos format.

man 5 crontab

Use this man command read about the formatting requirements for your /etc/crontab file.


Note: Two classes of user will use this command.
A user or the "root" user. Although, almost every Linux system, I've ran crontab -e as "root" does not support it.
In other words, if you are Sys Admin (root). Just vi /etc/crontab.

External links