ArGest Backup User Guide

⌘K
  1. Home
  2. Docs
  3. ArGest Backup User Guide
  4. Terminal Advanced Uses
  5. Setting Up a cron Entry

Setting Up a cron Entry

Many UNIX system administrators like to schedule their backups to run automatically, often in the middle of the night. This can be accomplished by using the cron facility. cron executes commands specified in a cron table that is created by the user. This table can be listed or modified with the crontab command.

Here is an example of how to list the current contents of the cron table. The commands shown are typical entries for the root user:

# crontab -l
17 5 * * 0 /etc/cleanup > /dev/null
0 2 * * 0,4 /usr/lib/cron/logchecker
0 3 * * * /usr/lib/cleantmp > /dev/null
20 1 * * * /usr/bin/calendar -

Each line in the crontab consists of six fields. The first five determine the time. The sixth field is the command that will be executed. The six fields are interpreted as follows:

Field Description
1 minutes (0 to 59)
2 hour (0 to 23)
3 day of month (1 to 31)
4 month (1 to 12)
5 day of week (0 to 6, 0=Sunday)
6 the command to execute

Some sample crontab entries are described below.

Run BRU every day at 2:30 a.m.:

30 2 * * * /bin/bru -c /

Run BRU at 10:00 p.m., Monday through Friday:

0 22 * * 1-5 /bin/bru -c /

Run the fullbru command at 3:00 a.m. every Saturday:

0 3 * * 6 /bin/fullbru

Run the incbru command at 4:00 a.m., Tuesday through Friday:

0 4 * * 2-5 /bin/incbru

Updating the crontab involves three steps:

  • 1: Create a file that contains a copy of the current cron table.
  • 2: Edit the file (or simply append a line to add a new entry).
  • 3: Update the cron table with the edited file.
  • Here’s a simple example that will add a new entry to the cron table:

    # crontab -l > cron.lst
    # echo “30 2 * * 2-6 /bin/bru -c” >> cron.lst
    # crontab cron.lst

    To verify that the entry has been added, list the contents of the cron table again:

    # crontab -l
    17 5 * * 0 /etc/cleanup > /dev/null
    0 2 * * 0,4 /usr/lib/cron/logchecker
    0 3 * * * /usr/lib/cleantmp > /dev/null
    20 1 * * * /usr/bin/calendar -
    30 2 * * 2-6 /bin/bru -c

    Note that the new entry for BRU has been added. For more information on creating crontab entries, refer to your system documentation on cron and crontab.