Table of Contents
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
- Click on the menu if it is not already expanded.
- Click on the ♦ CRON item.
- You should now be looking at the System CRON Management controls in the main content area.
- Choose which user you will add the CRON job to.
- Choose either Simple Interface (the default) or Advanced Interface from the CRON Editor: drop-down menu.
Procedure - Simple Interface
- 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.
- 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.
- 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.
- Set the Month interval. You can either set it to a specific month (e.g, Feb is every February), or All for every month.
- 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.
- Set the Script command you would like to run.
- Click the button to add the CRON job.
- 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 |
Procedure - Advanced Interface
- Set the Minute interval. You can either set it to a specific minute between
0and59(e.g,8is the 8th minute of every hour), some range (e.g.,5-10is minutes 5 through 10),*for every minute, or some interval (e.g.,*/10is every 10 minutes). - Set the Hour interval. You can either set it to a specific hour between
0and23(e.g,22is every day at 10PM), some range (e.g.,5-10is hours 5AM through 10AM),*for every hour, or some interval (e.g.,*/7is every 7 hours). - Set the Day interval. You can either set it to a specific day between
1and31(e.g,12is the 12th day of every month), some range (e.g.,1-15is days 1 through 15),*for every day, or some interval (*/3is every 3 days). - Set the Month interval. You can either set it to a specific month between
1and12(e.g,3is every February), some range (e.g.,5-7is months May through July),*for every month, or some interval (e.g.,*/2is every two months). - Set the Day of Week interval. You can either set it to a specific day of the week between
0and7(e.g,4is every Thursday),*for every day of the week, some range (e.g.,1-4is days Mondays through Wednesdays), or some interval (*/2is every 2 days of the week). Note that both0and7represent Sunday. - Set the Script command you would like to run.
- Click the button to add the CRON job.
- 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 |
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 | * |
