Logicalwebhost Cheatsheet

Linux & Open Source Cheatsheets & Howto's

Skip to: Content | Sidebar | Footer

Crontab HowTo

crontab in Linux can schedule certain task to happen automatically at whatever time you specify, then either e-mail when that happens or not if you disable it

Crontab Examples

crontab working by editing a file that is then run every so often. here is the list of what the fields mean:

The fields are:
 Min       minute of execution, 0-59
 Hour      hour of execution, 0-23
 Mday      day of month of execution, 1-31
 Month     month of execution, 1-12 (or names)
 Wday      day of week of execution, 1-7 (1 = monday, 7 = sunday, or names)
 Command   Anything that can be launched from the command line

If you want cron to ONLY e-mail you if there are errors, change the end of the command to read:

> /dev/null 2>&1 (don't send anything via email)
>/dev/null (only send you errors via email)

examples

1 1 * * * /usr/bin/rdate -s tick.greyware.com > /dev/null 2>&1 (sets time every day at 1:01 a.m., but doesn't email you)

Write a comment

You need to login to post comments!