InterWorx Cron Documentation

InterWorx allows the NodeWorx administrator the ability to control the system's crontabs without using command line. The NodeWorx administrator is able to do so for every *nix user on the system from the NodeWorx interface. The iworx system user has some special cron jobs for the control panel too which perform many important, necessary actions throughout the day to keep the control panel running smoothly.

Table of Contents

How to view a system user's crontab file

  1. Click the Icon Server menu item if it is not already open.
  2. Click the Icon CRON menu item.
  3. Locate the User: drop-down menu.
  4. In the User: drop-down menu, select the user whose crontab you would like to view. For example, to see the iworx user's crontab, choose iworx in the drop-down menu.
  5. You will now see the chosen user's crontab in the fields below.
  6. From here you may choose to add new CRON jobs, edit or delete existing CRON jobs, or edit CRON variables.

Manage a system user's crontab options

  1. Click the Icon Server menu item if it is not already open.
  2. Click the Icon CRON menu item.
  3. Choose the user whose crontab you would like to edit from the User: drop-down menu.
  4. You will now see the chosen user's crontab, and the various CRON options, in the fields below.
  5. Change the option(s) you wish to update to the desired value(s).
  6. Click the button.
  7. You will see the following message at the top of the screen: Cron variables successfully modified

CRON Options Reference

Shell
Choose the desired shell from the dropdown menu. All scripts will be executed with this shell. The default shell is /bin/sh.

PATH
The PATH CRON option is similar to setting the shell PATH environment variable. Setting the PATH CRON option sets the directories which will be used in the search path for CRON.

MAILTO
If an email address is provided here, any output produced by a cronjob will be emailed to this address.


Set a cron job

  1. Click the Icon Server menu item if it is not already open.
  2. Click the Icon CRON menu item.
  3. Choose which user you will add the CRON job to.
  4. 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 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 Monday through Wednesday), 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 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 [iw_table_header]Minute[/iw_table_header] interval.

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 6: 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 7 - 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 8 - 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 *

Edit a Cron Job

  1. Click the Icon Server menu item if it is not already open.
  2. Click the Icon CRON menu item.
  3. Choose which user's crontab you would like to edit.
  4. Click the [ Edit ] link next to the CRON job you would like to edit.
  5. Edit the CRON job.
  6. Click the button to update the CRON job.
  7. You will see the following message at the top of the screen: Cron job successfully updated

Delete a Cron Job

  1. Click the Icon Server menu item if it is not already open.
  2. Click the Icon CRON menu item.
  3. Choose the user whose crontab you would like to edit from the <b>User:</b> dropdown menu.
  4. You will now see the chosen user's crontab in the fields below, with a checkbox next to each cronjob.
  5. Mark the checkboxes next to the cronjobs you would like to delete. You may also click the [ Check All ] link at the bottom of the list to quickly check all the cronjobs.
  6. In the dropdown labeled with selected:, choose the Delete option.

InterWorx-specific cronjobs

The InterWorx cron jobs are extremely critical to the InterWorx control panel system. They manage disk and bandwidth quota enforcement, detect potential issues for your servers, compile stats, keep the license synchronized, etc. Without them, InterWorx would not function properly.

WARNING: Do not edit the iworx or system cron unless you know exactly what you are doing and are well versed in both InterWorx and Linux. This document will attempt to explain what the repercussions of doing so could be, but as always with something this complex, it is possible that other unforeseen things might happen resulting in a malfunctioning server and lost data. If you choose to edit anything always remember to make backups. This is presented here for informational purposes only and is NOT supported.

Overview:

The following cron process are run by the iworx system user and should not be deleted or edited unless there is a specific reason to do so. This is an example of typical crontab output but yours may have different start times.

# crontab -u iworx -l

27, 32, 37, 42, 47, 52, 57, 2, 7, 12, 17, 22 * * * * cd /home/interworx/cron ;./iworx.pex --fively

31, 46, 1, 16 * * * * cd /home/interworx/cron ; ./iworx.pex --fifteenly

20 * * * * cd /home/interworx/cron ; ./iworx.pex --hourly

49 20, 2, 8, 14 * * * cd /home/interworx/cron ; ./iworx.pex --quad_daily

10 21 * * * cd /home/interworx/cron ; ./iworx.pex --daily

44 23 * * 5 cd /home/interworx/cron ; ./iworx.pex --weekly

18 0 8 * * cd /home/interworx/cron ; ./iworx.pex --monthly

If you need to know if a particular cron process is running regularly, the cron error log is located /var/log/cron. Run tail -10 /var/log/cron to view the last 10 entries.

iworx.pex --fively
fively - rrd graphs updated, dns exported, and if in the iworx.ini has runtime=fively (the default) it does bandwidth and storage calculations too. Runs every 5 minutes.

iworx.pex --fifteenly
fifteenly - bandwidth and storage if the iworx.ini has runtime=fifteenly. Runs every 15 minutes.

iworx.pex --hourly
hourly - bandwidth and storage if the iworx.ini has runtime=hourly. Runs every hour.

iworx.pex --quad_daily

quad_daily - license.sync, and bandwidth and storage if the iworx.ini has runtime=quad_daily. Runs 4 times a day (every 6 hours).

iworx.pex --daily
daily - OS update, bayes training, and bandwidth and storage if the iworx.ini has runtime=daily

Specifically:

  • yum - does the equivalent of yum check-update; yum update;
  • stats - runs through all domains and does all stats programs, and rotates the logs upon completion.
  • spamassassin training - uses "sa-learn" to train messages in users' Learn Spam / Learn Ham folders.

iworx.pex --weekly
does not do anything at the moment

iworx.pex --monthly
does not do anything at the moment