Crontab: a Quick reference

Posted by acidjunk on April 15, 2010

cron is a utility that you can use to schedule and automate tasks. By defining items in the cron table, called crontab, you can schedule any script or program to run on almost any sort of schedule.

For example, run a program each day 5 minutes after midnight on mondays, wednesdays and fridays. Or schedule something to run every five minutes, or once a month.

Basics

Each user has their own crontab, the scheduled scripts run as that user take this in account with regards to permissions. To edit the crontab use the following command:

$ crontab -e

You can list what your currnet crontab is using the following command:

$ crontab -l

Crontab Format

The following is the format entries in a crontab must be. Note all lines starting with # are ignored, comments.

# MIN   HOUR   MDAY  MON  DOW   COMMAND 
   5     *      *     *    *    echo 'Hello'
Item Definition Valid Values
MIN Minute 0-60
HOUR Hour [24-hour clock] 0-23
MDAY Day of Month 1-31
MON Month 1-12 OR jan,feb,mar,apr …
DOW Day of Week 0-6 OR
sun,mon,tue,wed,thu,fri,sat
COMMAND Command to be run Any valid command-line

Examples

Here are a few examples, to see what some entries look like.

<br /> #Run command at 7:00am each weekday [mon-fri]<br /> 00 07 * * 1-5 mail_pager.script 'Wake Up'

#Run command on 1st of each month, at 5:30pm

30 17 1 * * pay_rent.script

#Run command at 8:00am,10:00am and 2:00pm every day

00 8,10,14 * * * do_something.script

#Run command every 5 minutes during market hours

*/5 6-13 * * mon-fri get_stock_quote.script

#Run command every 3-hours while awake

0 7-23/3 * * * drink_water.script

Special Characters in Crontab

You can use an asterisk in any category to mean for every item, such as every day or every month.

You can use commas in any category to specify multiple values. For example: mon,wed,fri

You can use dashes to specify ranges. For example: mon-fri, or 9-17

You can use forward slash to specify a repeating range. For example: */5 for every five minutes, hours, days

Special Entries

There are several special entries, some which are just shortcuts, that you can use instead of specifying the full cron entry.

The most useful of these is probably @reboot which allows you to run a command each time the computer gets reboot. This could be useful if you want to start up a server or daemon under a particular user, or if you do not have access to the rc.d/init.d files.

Example Usage:

``cron is a utility that you can use to schedule and automate tasks. By defining items in the cron table, called crontab, you can schedule any script or program to run on almost any sort of schedule.

For example, run a program each day 5 minutes after midnight on mondays, wednesdays and fridays. Or schedule something to run every five minutes, or once a month.

Basics

Each user has their own crontab, the scheduled scripts run as that user take this in account with regards to permissions. To edit the crontab use the following command:

$ crontab -e

You can list what your currnet crontab is using the following command:

$ crontab -l

Crontab Format

The following is the format entries in a crontab must be. Note all lines starting with # are ignored, comments.

# MIN   HOUR   MDAY  MON  DOW   COMMAND 
   5     *      *     *    *    echo 'Hello'
Item Definition Valid Values
MIN Minute 0-60
HOUR Hour [24-hour clock] 0-23
MDAY Day of Month 1-31
MON Month 1-12 OR jan,feb,mar,apr …
DOW Day of Week 0-6 OR
sun,mon,tue,wed,thu,fri,sat
COMMAND Command to be run Any valid command-line

Examples

Here are a few examples, to see what some entries look like.

<br /> #Run command at 7:00am each weekday [mon-fri]<br /> 00 07 * * 1-5 mail_pager.script 'Wake Up'

#Run command on 1st of each month, at 5:30pm

30 17 1 * * pay_rent.script

#Run command at 8:00am,10:00am and 2:00pm every day

00 8,10,14 * * * do_something.script

#Run command every 5 minutes during market hours

*/5 6-13 * * mon-fri get_stock_quote.script

#Run command every 3-hours while awake

0 7-23/3 * * * drink_water.script

Special Characters in Crontab

You can use an asterisk in any category to mean for every item, such as every day or every month.

You can use commas in any category to specify multiple values. For example: mon,wed,fri

You can use dashes to specify ranges. For example: mon-fri, or 9-17

You can use forward slash to specify a repeating range. For example: */5 for every five minutes, hours, days

Special Entries

There are several special entries, some which are just shortcuts, that you can use instead of specifying the full cron entry.

The most useful of these is probably @reboot which allows you to run a command each time the computer gets reboot. This could be useful if you want to start up a server or daemon under a particular user, or if you do not have access to the rc.d/init.d files.

Example Usage:

``

The complete list:

Entry Description Equivalent To
@reboot Run once, at startup. None
@yearly Run once a year 0 0 1 1 *
@annually (same as @yearly) 0 0 1 1 *
@monthly Run once a month 0 0 1 * *
@weekly Run once a week 0 0 * * 0
@daily Run once a day 0 0 * * *
@midnight (same as @daily) 0 0 * * *
@hourly Run once an hour 0 * * * *

Miscelleanous Issues

Script Output

If there is any output from your script or command it will be sent to that user’s e-mail account, on that box. Using the default mailer which must be setup properly.

You can set the variable MAILTO in the crontab to specify a separate e-mail address to use. For example:

```cron is a utility that you can use to schedule and automate tasks. By defining items in the cron table, called crontab, you can schedule any script or program to run on almost any sort of schedule.

For example, run a program each day 5 minutes after midnight on mondays, wednesdays and fridays. Or schedule something to run every five minutes, or once a month.

Basics

Each user has their own crontab, the scheduled scripts run as that user take this in account with regards to permissions. To edit the crontab use the following command:

$ crontab -e

You can list what your currnet crontab is using the following command:

$ crontab -l

Crontab Format

The following is the format entries in a crontab must be. Note all lines starting with # are ignored, comments.

# MIN   HOUR   MDAY  MON  DOW   COMMAND 
   5     *      *     *    *    echo 'Hello'
Item Definition Valid Values
MIN Minute 0-60
HOUR Hour [24-hour clock] 0-23
MDAY Day of Month 1-31
MON Month 1-12 OR jan,feb,mar,apr …
DOW Day of Week 0-6 OR
sun,mon,tue,wed,thu,fri,sat
COMMAND Command to be run Any valid command-line

Examples

Here are a few examples, to see what some entries look like.

<br /> #Run command at 7:00am each weekday [mon-fri]<br /> 00 07 * * 1-5 mail_pager.script 'Wake Up'

#Run command on 1st of each month, at 5:30pm

30 17 1 * * pay_rent.script

#Run command at 8:00am,10:00am and 2:00pm every day

00 8,10,14 * * * do_something.script

#Run command every 5 minutes during market hours

*/5 6-13 * * mon-fri get_stock_quote.script

#Run command every 3-hours while awake

0 7-23/3 * * * drink_water.script

Special Characters in Crontab

You can use an asterisk in any category to mean for every item, such as every day or every month.

You can use commas in any category to specify multiple values. For example: mon,wed,fri

You can use dashes to specify ranges. For example: mon-fri, or 9-17

You can use forward slash to specify a repeating range. For example: */5 for every five minutes, hours, days

Special Entries

There are several special entries, some which are just shortcuts, that you can use instead of specifying the full cron entry.

The most useful of these is probably @reboot which allows you to run a command each time the computer gets reboot. This could be useful if you want to start up a server or daemon under a particular user, or if you do not have access to the rc.d/init.d files.

Example Usage:

``cron is a utility that you can use to schedule and automate tasks. By defining items in the cron table, called crontab, you can schedule any script or program to run on almost any sort of schedule.

For example, run a program each day 5 minutes after midnight on mondays, wednesdays and fridays. Or schedule something to run every five minutes, or once a month.

Basics

Each user has their own crontab, the scheduled scripts run as that user take this in account with regards to permissions. To edit the crontab use the following command:

$ crontab -e

You can list what your currnet crontab is using the following command:

$ crontab -l

Crontab Format

The following is the format entries in a crontab must be. Note all lines starting with # are ignored, comments.

# MIN   HOUR   MDAY  MON  DOW   COMMAND 
   5     *      *     *    *    echo 'Hello'
Item Definition Valid Values
MIN Minute 0-60
HOUR Hour [24-hour clock] 0-23
MDAY Day of Month 1-31
MON Month 1-12 OR jan,feb,mar,apr …
DOW Day of Week 0-6 OR
sun,mon,tue,wed,thu,fri,sat
COMMAND Command to be run Any valid command-line

Examples

Here are a few examples, to see what some entries look like.

<br /> #Run command at 7:00am each weekday [mon-fri]<br /> 00 07 * * 1-5 mail_pager.script 'Wake Up'

#Run command on 1st of each month, at 5:30pm

30 17 1 * * pay_rent.script

#Run command at 8:00am,10:00am and 2:00pm every day

00 8,10,14 * * * do_something.script

#Run command every 5 minutes during market hours

*/5 6-13 * * mon-fri get_stock_quote.script

#Run command every 3-hours while awake

0 7-23/3 * * * drink_water.script

Special Characters in Crontab

You can use an asterisk in any category to mean for every item, such as every day or every month.

You can use commas in any category to specify multiple values. For example: mon,wed,fri

You can use dashes to specify ranges. For example: mon-fri, or 9-17

You can use forward slash to specify a repeating range. For example: */5 for every five minutes, hours, days

Special Entries

There are several special entries, some which are just shortcuts, that you can use instead of specifying the full cron entry.

The most useful of these is probably @reboot which allows you to run a command each time the computer gets reboot. This could be useful if you want to start up a server or daemon under a particular user, or if you do not have access to the rc.d/init.d files.

Example Usage:

``

The complete list:

Entry Description Equivalent To
@reboot Run once, at startup. None
@yearly Run once a year 0 0 1 1 *
@annually (same as @yearly) 0 0 1 1 *
@monthly Run once a month 0 0 1 * *
@weekly Run once a week 0 0 * * 0
@daily Run once a day 0 0 * * *
@midnight (same as @daily) 0 0 * * *
@hourly Run once an hour 0 * * * *

Miscelleanous Issues

Script Output

If there is any output from your script or command it will be sent to that user’s e-mail account, on that box. Using the default mailer which must be setup properly.

You can set the variable MAILTO in the crontab to specify a separate e-mail address to use. For example:


**Redirect Output to /dev/null**
  
You can redirect the output from a cron script to /dev/null which just throws it away. By redirecting to /dev/null you will not receive anything from the script, even if it is throwing errors.

````**cron** is a utility that you can use to schedule and automate tasks. By defining items in the cron table, called **crontab**, you can schedule any script or program to run on almost any sort of schedule.

For example, run a program each day 5 minutes after midnight on mondays, wednesdays and fridays. Or schedule something to run every five minutes, or once a month.

### Basics

Each user has their own crontab, the scheduled scripts run as that user take this in account with regards to permissions. To edit the crontab use the following command:
  
`$ crontab -e`

You can list what your currnet crontab is using the following command:
  
`$ crontab -l`

**Crontab Format**
  
The following is the format entries in a crontab must be. Note all lines starting with # are ignored, comments.

<pre># MIN   HOUR   MDAY  MON  DOW   COMMAND 
   5     *      *     *    *    echo 'Hello'</pre>

<table cellspacing="1" cellpadding="4">
  <tr bgcolor="#eeeeee">
    <th>
      Item
    </th>
    
    <th>
      Definition
    </th>
    
    <th>
      Valid Values
    </th>
  </tr>
  
  <tr>
    <td>
      MIN
    </td>
    
    <td>
      Minute
    </td>
    
    <td>
      0-60
    </td>
  </tr>
  
  <tr>
    <td>
      HOUR
    </td>
    
    <td>
      Hour [24-hour clock]
    </td>
    
    <td>
      0-23
    </td>
  </tr>
  
  <tr>
    <td>
      MDAY
    </td>
    
    <td>
      Day of Month
    </td>
    
    <td>
      1-31
    </td>
  </tr>
  
  <tr>
    <td>
      MON
    </td>
    
    <td>
      Month
    </td>
    
    <td>
      1-12 OR jan,feb,mar,apr …
    </td>
  </tr>
  
  <tr>
    <td>
      DOW
    </td>
    
    <td>
      Day of Week
    </td>
    
    <td>
      0-6 OR<br /> sun,mon,tue,wed,thu,fri,sat
    </td>
  </tr>
  
  <tr>
    <td>
      COMMAND
    </td>
    
    <td>
      Command to be run
    </td>
    
    <td>
      Any valid command-line
    </td>
  </tr>
</table>

### Examples

Here are a few examples, to see what some entries look like.

`<br />
#Run command at 7:00am each weekday [mon-fri]<br />
00 07 * * 1-5 mail_pager.script 'Wake Up'`

#Run command on 1st of each month, at 5:30pm
  
30 17 1 \* \* pay_rent.script

#Run command at 8:00am,10:00am and 2:00pm every day
  
00 8,10,14 \* \* * do_something.script

#Run command every 5 minutes during market hours
  
\*/5 6-13 \* * mon-fri get\_stock\_quote.script

#Run command every 3-hours while awake
  
0 7-23/3 \* \* * drink_water.script

### Special Characters in Crontab

You can use an **asterisk** in any category to mean for every item, such as every day or every month.

You can use **commas** in any category to specify multiple values. For example: `mon,wed,fri`

You can use **dashes** to specify ranges. For example: `mon-fri`, or `9-17`

You can use **forward slash** to specify a repeating range. For example: `*/5` for every five minutes, hours, days

### Special Entries

There are several special entries, some which are just shortcuts, that you can use instead of specifying the full cron entry.

The most useful of these is probably **@reboot** which allows you to run a command each time the computer gets reboot. This could be useful if you want to start up a server or daemon under a particular user, or if you do not have access to the rc.d/init.d files.

**Example Usage:** 
  
``**cron** is a utility that you can use to schedule and automate tasks. By defining items in the cron table, called **crontab**, you can schedule any script or program to run on almost any sort of schedule.

For example, run a program each day 5 minutes after midnight on mondays, wednesdays and fridays. Or schedule something to run every five minutes, or once a month.

### Basics

Each user has their own crontab, the scheduled scripts run as that user take this in account with regards to permissions. To edit the crontab use the following command:
  
`$ crontab -e`

You can list what your currnet crontab is using the following command:
  
`$ crontab -l`

**Crontab Format**
  
The following is the format entries in a crontab must be. Note all lines starting with # are ignored, comments.

<pre># MIN   HOUR   MDAY  MON  DOW   COMMAND 
   5     *      *     *    *    echo 'Hello'</pre>

<table cellspacing="1" cellpadding="4">
  <tr bgcolor="#eeeeee">
    <th>
      Item
    </th>
    
    <th>
      Definition
    </th>
    
    <th>
      Valid Values
    </th>
  </tr>
  
  <tr>
    <td>
      MIN
    </td>
    
    <td>
      Minute
    </td>
    
    <td>
      0-60
    </td>
  </tr>
  
  <tr>
    <td>
      HOUR
    </td>
    
    <td>
      Hour [24-hour clock]
    </td>
    
    <td>
      0-23
    </td>
  </tr>
  
  <tr>
    <td>
      MDAY
    </td>
    
    <td>
      Day of Month
    </td>
    
    <td>
      1-31
    </td>
  </tr>
  
  <tr>
    <td>
      MON
    </td>
    
    <td>
      Month
    </td>
    
    <td>
      1-12 OR jan,feb,mar,apr …
    </td>
  </tr>
  
  <tr>
    <td>
      DOW
    </td>
    
    <td>
      Day of Week
    </td>
    
    <td>
      0-6 OR<br /> sun,mon,tue,wed,thu,fri,sat
    </td>
  </tr>
  
  <tr>
    <td>
      COMMAND
    </td>
    
    <td>
      Command to be run
    </td>
    
    <td>
      Any valid command-line
    </td>
  </tr>
</table>

### Examples

Here are a few examples, to see what some entries look like.

`<br />
#Run command at 7:00am each weekday [mon-fri]<br />
00 07 * * 1-5 mail_pager.script 'Wake Up'`

#Run command on 1st of each month, at 5:30pm
  
30 17 1 \* \* pay_rent.script

#Run command at 8:00am,10:00am and 2:00pm every day
  
00 8,10,14 \* \* * do_something.script

#Run command every 5 minutes during market hours
  
\*/5 6-13 \* * mon-fri get\_stock\_quote.script

#Run command every 3-hours while awake
  
0 7-23/3 \* \* * drink_water.script

### Special Characters in Crontab

You can use an **asterisk** in any category to mean for every item, such as every day or every month.

You can use **commas** in any category to specify multiple values. For example: `mon,wed,fri`

You can use **dashes** to specify ranges. For example: `mon-fri`, or `9-17`

You can use **forward slash** to specify a repeating range. For example: `*/5` for every five minutes, hours, days

### Special Entries

There are several special entries, some which are just shortcuts, that you can use instead of specifying the full cron entry.

The most useful of these is probably **@reboot** which allows you to run a command each time the computer gets reboot. This could be useful if you want to start up a server or daemon under a particular user, or if you do not have access to the rc.d/init.d files.

**Example Usage:** 
  
`` 

The complete list:

<table cellspacing="1" cellpadding="4">
  <tr bgcolor="#eeeeee">
    <th>
      Entry
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Equivalent To
    </th>
  </tr>
  
  <tr>
    <td>
      @reboot
    </td>
    
    <td>
      Run once, at startup.
    </td>
    
    <td>
      None
    </td>
  </tr>
  
  <tr>
    <td>
      @yearly
    </td>
    
    <td>
      Run once a year
    </td>
    
    <td>
      0 0 1 1 *
    </td>
  </tr>
  
  <tr>
    <td>
      @annually
    </td>
    
    <td>
      (same as @yearly)
    </td>
    
    <td>
      0 0 1 1 *
    </td>
  </tr>
  
  <tr>
    <td>
      @monthly
    </td>
    
    <td>
      Run once a month
    </td>
    
    <td>
      0 0 1 * *
    </td>
  </tr>
  
  <tr>
    <td>
      @weekly
    </td>
    
    <td>
      Run once a week
    </td>
    
    <td>
      0 0 * * 0
    </td>
  </tr>
  
  <tr>
    <td>
      @daily
    </td>
    
    <td>
      Run once a day
    </td>
    
    <td>
      0 0 * * *
    </td>
  </tr>
  
  <tr>
    <td>
      @midnight
    </td>
    
    <td>
      (same as @daily)
    </td>
    
    <td>
      0 0 * * *
    </td>
  </tr>
  
  <tr>
    <td>
      @hourly
    </td>
    
    <td>
      Run once an hour
    </td>
    
    <td>
      0 * * * *
    </td>
  </tr>
</table>

### Miscelleanous Issues

**Script Output**
  
If there is any output from your script or command it will be sent to that user’s e-mail account, on that box. Using the default mailer which must be setup properly.

You can set the variable MAILTO in the crontab to specify a separate e-mail address to use. For example:
  
```**cron** is a utility that you can use to schedule and automate tasks. By defining items in the cron table, called **crontab**, you can schedule any script or program to run on almost any sort of schedule.

For example, run a program each day 5 minutes after midnight on mondays, wednesdays and fridays. Or schedule something to run every five minutes, or once a month.

### Basics

Each user has their own crontab, the scheduled scripts run as that user take this in account with regards to permissions. To edit the crontab use the following command:
  
`$ crontab -e`

You can list what your currnet crontab is using the following command:
  
`$ crontab -l`

**Crontab Format**
  
The following is the format entries in a crontab must be. Note all lines starting with # are ignored, comments.

<pre># MIN   HOUR   MDAY  MON  DOW   COMMAND 
   5     *      *     *    *    echo 'Hello'</pre>

<table cellspacing="1" cellpadding="4">
  <tr bgcolor="#eeeeee">
    <th>
      Item
    </th>
    
    <th>
      Definition
    </th>
    
    <th>
      Valid Values
    </th>
  </tr>
  
  <tr>
    <td>
      MIN
    </td>
    
    <td>
      Minute
    </td>
    
    <td>
      0-60
    </td>
  </tr>
  
  <tr>
    <td>
      HOUR
    </td>
    
    <td>
      Hour [24-hour clock]
    </td>
    
    <td>
      0-23
    </td>
  </tr>
  
  <tr>
    <td>
      MDAY
    </td>
    
    <td>
      Day of Month
    </td>
    
    <td>
      1-31
    </td>
  </tr>
  
  <tr>
    <td>
      MON
    </td>
    
    <td>
      Month
    </td>
    
    <td>
      1-12 OR jan,feb,mar,apr …
    </td>
  </tr>
  
  <tr>
    <td>
      DOW
    </td>
    
    <td>
      Day of Week
    </td>
    
    <td>
      0-6 OR<br /> sun,mon,tue,wed,thu,fri,sat
    </td>
  </tr>
  
  <tr>
    <td>
      COMMAND
    </td>
    
    <td>
      Command to be run
    </td>
    
    <td>
      Any valid command-line
    </td>
  </tr>
</table>

### Examples

Here are a few examples, to see what some entries look like.

`<br />
#Run command at 7:00am each weekday [mon-fri]<br />
00 07 * * 1-5 mail_pager.script 'Wake Up'`

#Run command on 1st of each month, at 5:30pm
  
30 17 1 \* \* pay_rent.script

#Run command at 8:00am,10:00am and 2:00pm every day
  
00 8,10,14 \* \* * do_something.script

#Run command every 5 minutes during market hours
  
\*/5 6-13 \* * mon-fri get\_stock\_quote.script

#Run command every 3-hours while awake
  
0 7-23/3 \* \* * drink_water.script

### Special Characters in Crontab

You can use an **asterisk** in any category to mean for every item, such as every day or every month.

You can use **commas** in any category to specify multiple values. For example: `mon,wed,fri`

You can use **dashes** to specify ranges. For example: `mon-fri`, or `9-17`

You can use **forward slash** to specify a repeating range. For example: `*/5` for every five minutes, hours, days

### Special Entries

There are several special entries, some which are just shortcuts, that you can use instead of specifying the full cron entry.

The most useful of these is probably **@reboot** which allows you to run a command each time the computer gets reboot. This could be useful if you want to start up a server or daemon under a particular user, or if you do not have access to the rc.d/init.d files.

**Example Usage:** 
  
``**cron** is a utility that you can use to schedule and automate tasks. By defining items in the cron table, called **crontab**, you can schedule any script or program to run on almost any sort of schedule.

For example, run a program each day 5 minutes after midnight on mondays, wednesdays and fridays. Or schedule something to run every five minutes, or once a month.

### Basics

Each user has their own crontab, the scheduled scripts run as that user take this in account with regards to permissions. To edit the crontab use the following command:
  
`$ crontab -e`

You can list what your currnet crontab is using the following command:
  
`$ crontab -l`

**Crontab Format**
  
The following is the format entries in a crontab must be. Note all lines starting with # are ignored, comments.

<pre># MIN   HOUR   MDAY  MON  DOW   COMMAND 
   5     *      *     *    *    echo 'Hello'</pre>

<table cellspacing="1" cellpadding="4">
  <tr bgcolor="#eeeeee">
    <th>
      Item
    </th>
    
    <th>
      Definition
    </th>
    
    <th>
      Valid Values
    </th>
  </tr>
  
  <tr>
    <td>
      MIN
    </td>
    
    <td>
      Minute
    </td>
    
    <td>
      0-60
    </td>
  </tr>
  
  <tr>
    <td>
      HOUR
    </td>
    
    <td>
      Hour [24-hour clock]
    </td>
    
    <td>
      0-23
    </td>
  </tr>
  
  <tr>
    <td>
      MDAY
    </td>
    
    <td>
      Day of Month
    </td>
    
    <td>
      1-31
    </td>
  </tr>
  
  <tr>
    <td>
      MON
    </td>
    
    <td>
      Month
    </td>
    
    <td>
      1-12 OR jan,feb,mar,apr …
    </td>
  </tr>
  
  <tr>
    <td>
      DOW
    </td>
    
    <td>
      Day of Week
    </td>
    
    <td>
      0-6 OR<br /> sun,mon,tue,wed,thu,fri,sat
    </td>
  </tr>
  
  <tr>
    <td>
      COMMAND
    </td>
    
    <td>
      Command to be run
    </td>
    
    <td>
      Any valid command-line
    </td>
  </tr>
</table>

### Examples

Here are a few examples, to see what some entries look like.

`<br />
#Run command at 7:00am each weekday [mon-fri]<br />
00 07 * * 1-5 mail_pager.script 'Wake Up'`

#Run command on 1st of each month, at 5:30pm
  
30 17 1 \* \* pay_rent.script

#Run command at 8:00am,10:00am and 2:00pm every day
  
00 8,10,14 \* \* * do_something.script

#Run command every 5 minutes during market hours
  
\*/5 6-13 \* * mon-fri get\_stock\_quote.script

#Run command every 3-hours while awake
  
0 7-23/3 \* \* * drink_water.script

### Special Characters in Crontab

You can use an **asterisk** in any category to mean for every item, such as every day or every month.

You can use **commas** in any category to specify multiple values. For example: `mon,wed,fri`

You can use **dashes** to specify ranges. For example: `mon-fri`, or `9-17`

You can use **forward slash** to specify a repeating range. For example: `*/5` for every five minutes, hours, days

### Special Entries

There are several special entries, some which are just shortcuts, that you can use instead of specifying the full cron entry.

The most useful of these is probably **@reboot** which allows you to run a command each time the computer gets reboot. This could be useful if you want to start up a server or daemon under a particular user, or if you do not have access to the rc.d/init.d files.

**Example Usage:** 
  
`` 

The complete list:

<table cellspacing="1" cellpadding="4">
  <tr bgcolor="#eeeeee">
    <th>
      Entry
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Equivalent To
    </th>
  </tr>
  
  <tr>
    <td>
      @reboot
    </td>
    
    <td>
      Run once, at startup.
    </td>
    
    <td>
      None
    </td>
  </tr>
  
  <tr>
    <td>
      @yearly
    </td>
    
    <td>
      Run once a year
    </td>
    
    <td>
      0 0 1 1 *
    </td>
  </tr>
  
  <tr>
    <td>
      @annually
    </td>
    
    <td>
      (same as @yearly)
    </td>
    
    <td>
      0 0 1 1 *
    </td>
  </tr>
  
  <tr>
    <td>
      @monthly
    </td>
    
    <td>
      Run once a month
    </td>
    
    <td>
      0 0 1 * *
    </td>
  </tr>
  
  <tr>
    <td>
      @weekly
    </td>
    
    <td>
      Run once a week
    </td>
    
    <td>
      0 0 * * 0
    </td>
  </tr>
  
  <tr>
    <td>
      @daily
    </td>
    
    <td>
      Run once a day
    </td>
    
    <td>
      0 0 * * *
    </td>
  </tr>
  
  <tr>
    <td>
      @midnight
    </td>
    
    <td>
      (same as @daily)
    </td>
    
    <td>
      0 0 * * *
    </td>
  </tr>
  
  <tr>
    <td>
      @hourly
    </td>
    
    <td>
      Run once an hour
    </td>
    
    <td>
      0 * * * *
    </td>
  </tr>
</table>

### Miscelleanous Issues

**Script Output**
  
If there is any output from your script or command it will be sent to that user’s e-mail account, on that box. Using the default mailer which must be setup properly.

You can set the variable MAILTO in the crontab to specify a separate e-mail address to use. For example:
  

Redirect Output to /dev/null

You can redirect the output from a cron script to /dev/null which just throws it away. By redirecting to /dev/null you will not receive anything from the script, even if it is throwing errors.

````

Missed Schedule Time

Cron does not run a command if it was missed. Your computer must be running for cron to run the job at the time it is scheduled. For example, if you have a 1:00am scheduled job and your computer was off at that time, it will not run the missed job in the morning when you turn it on.