How to Add a CRON Job

Prerequisites

Last Updated for InterWorx-CP version 2.1.0

No special prerequisites.

Purpose

CRON jobs are useful when there are tasks you would like to run automatically at scheduled times.

Procedure

  1. Click on the Server menu if it is not already expanded.
  2. Click on the ♦    CRON item.
  3. You should now be looking at the System CRON Management controls in the main content area.
  4. Choose which user you will add the CRON job to.
  5. Choose either Simple Interface (the default) or Advanced Interface from the CRON Editor: drop-down menu.

Procedure - Simple Interface

  1. Set the Minute interval. You can either set it to a specific minute (e.g, 8 is the 8th minute of every hour), or some interval (every 2, 5, 10, or 15th minute), or All for every minute.
  2. Set the Hour interval. You can either set it to a specific hour (e.g, 10PM is every day at 10PM), or some interval (every 2, 4, or 6th hour), or All for every hour.
  3. Set the Day interval. You can either set it to a specific day (e.g, 12 is the 12th day of every month), or All for every day.
  4. Set the Month interval. You can either set it to a specific month (e.g, Feb is every February), or All for every month.
  5. Set the Day of Week interval. You can either set it to a specific day of the week (e.g, Wed is every Wednesday), or All for every day of the week.
  6. Set the Script command you would like to run.
  7. Click the Add button to add the CRON job.
  8. You will see the following message at the top of the screen: » Cron job successfully added

 You can select multiple values for any of the intervals. For example, you can hold the CTRL key and click Sun and Tue to select both Sundays and Tuesdays.

Procedure - Advanced Interface

  1. Set the Minute interval. You can either set it to a specific minute between 0 and 59 (e.g, 8 is the 8th minute of every hour), some range (e.g., 5-10 is minutes 5 through 10), * for every minute, or some interval (e.g., */10 is every 10 minutes).
  2. Set the Hour interval. You can either set it to a specific hour between 0 and 23 (e.g, 22 is every day at 10PM), some range (e.g., 5-10 is hours 5AM through 10AM), * for every hour, or some interval (e.g., */7 is every 7 hours).
  3. Set the Day interval. You can either set it to a specific day between 1 and 31 (e.g, 12 is the 12th day of every month), some range (e.g., 1-15 is days 1 through 15), * for every day, or some interval (*/3 is every 3 days).
  4. Set the Month interval. You can either set it to a specific month between 1 and 12 (e.g, 3 is every February), some range (e.g., 5-7 is months May through July), * for every month, or some interval (e.g., */2 is every two months).
  5. Set the Day of Week interval. You can either set it to a specific day of the week between 0 and 7 (e.g, 4 is every Thursday), * for every day of the week, some range (e.g., 1-4 is days Mondays through Wednesdays), or some interval (*/2 is every 2 days of the week). Note that both 0 and 7 represent Sunday.
  6. Set the Script command you would like to run.
  7. Click the Add button to add the CRON job.
  8. You will see the following message at the top of the screen: » Cron job successfully added

 You can also do multiple values for any of the intervals by using commas to separate them. For example, to do every 7th, 11th, and 14th minute and every 30 minutes you can use 7,11,14,*/30 for the Minute interval.

CRON Examples

The following are a few CRON examples, and how to set them up in both interfaces.

Example 1: Every 5 Minutes

Run every 5 minutes.

Simple Interface

Minute Hour Day Month Day of Week
Every 5 All All All All

Advanced Interface

Minute Hour Day Month Day of Week
*/5 * * * *

Example 2: Yearly

Run yearly (at exactly midnight on January 1st).

Simple Interface

Minute Hour Day Month Day of Week
0 Midnight 1 Jan All

Advanced Interface

Minute Hour Day Month Day of Week
0 0 1 1 *

Example 3: Monthly

Run monthly (at 2:15AM on the 5th of each month).

Simple Interface

Minute Hour Day Month Day of Week
15 2AM 5 All All

Advanced Interface

Minute Hour Day Month Day of Week
15 2 5 * *

Example 4: Weekly

Run weekly (at 4:32PM on every Thursday).

Simple Interface

Minute Hour Day Month Day of Week
32 4PM All All Thu

Advanced Interface

Minute Hour Day Month Day of Week
32 16 * * 4

Example 5: Daily

Run daily (at 12:45AM every day).

Simple Interface

Minute Hour Day Month Day of Week
45 Midnight All All All

Advanced Interface

Minute Hour Day Month Day of Week
45 0 * * *

Example 5: Hourly

Run hourly (at 24 minutes past the hour).

Simple Interface

Minute Hour Day Month Day of Week
24 All All All All

Advanced Interface

Minute Hour Day Month Day of Week
24 * * * *

Example 6 - Complex 1

Run 52 minutes after the hour every 4 hours (e.g., 12:52AM, 4:52AM, 8:52AM, etc...).

Simple Interface

Minute Hour Day Month Day of Week
52 Every 4 All All All

Advanced Interface

Minute Hour Day Month Day of Week
52 */4 * * *

Example 7 - Complex 2

Run 8, 22, and 47 minutes after the hour at 2AM and 2PM (e.g., 2:08AM, 2:22AM, 2:47AM, 2:08PM, 2:22PM, 2:47PM) of every third month.

Simple Interface

Minute Hour Day Month Day of Week
8,
22,
47
2AM,
2PM
All Jan,
Apr,
Aug,
Dec
All

Advanced Interface

Minute Hour Day Month Day of Week
8,22,47 2,14 * */3 *

COPYRIGHT © InterWorx L.L.C. 2004-2008 PRIVACY POLICYEULA