Revision as of 14:25, 15 April 2015 by Lthibert (talk | contribs)
Jump to navigation Jump to search


Cron is a Unix-based program that enables you to schedule recurrent jobs. Here, we provide you a simple overview of how to get started using Cron on the daemon server. For a more in-depth explanation of Cron, please visit one of the pages in the resources section.


To schedule a task to run regularly with cron, you will need to edit the cron table or crontab. Please note that configuration is server-specific so you must be logged in to the server on which tasks will run (most likely daemon1).

Editing crontab file

The default crontab editor is vi. For ease of use, we recommend using a different text editor such as nano. You can change editors with the EDITOR or VISUAL command. For example:

export EDITOR=nano


export VISUAL=nano

Once your preferred editor is set, create a new or open an existing crontab file by typing the following command:

crontab -e

Email notifications

To receive an email with the output of each command you run, you should add the MAILTO variable at the beginning of your file:


where $ is substituted with your email address.

Crontab fields

Next, in the same file, type one or more lines with instructions for cron. Each line has six fields. If you do not wish to specify a value for a field, place an asterisk (*) there. The crontab fields are listed in the table below.

Crontab fields
minute hour day of month month day of week command to be executed
0-59 0-23 1-31 1-12
(1 = January)
(0 = Sunday)
must be an absolute path where $USER is your UFRC username and is the command you wish to run
* * * * * /home/$USER/bin/

Some simple examples

Runs every minute:

* * * * *

Runs at 30 past the hour:

30 * * * *

Runs at 3:15 a.m. every day:

15 3 * * *

Runs at 3:15 p.m. every day:

15 15 * * *

Runs at 3:15 a.m. every Monday:

15 3 * * 1

Runs at 3:15 a.m. on the first of every month:

15 3 1 * *


If you want to learn more about Cron and create more complex crontab files, we recommend the following resources: