Difference between revisions of "Crontab"


From Knoppix Documentation Wiki
Jump to: navigation, search
(External links)
Line 26: Line 26:
 
* [http://www.math-linux.com/spip.php?article45  Crontab : Scheduling Tasks]
 
* [http://www.math-linux.com/spip.php?article45  Crontab : Scheduling Tasks]
 
[[Category:Useful Linux Commands]]
 
[[Category:Useful Linux Commands]]
 +
 +
* [http://www.hxpi.com/cron_sandbox.php  A safe place to experiment with crontab commands is Cron Sandbox at HxPI where you can see straightaway a future schedule of run times for whatever crontab parameters you type in.]

Revision as of 06:54, 19 June 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