How to: Manage Scheduled Tasks Using Cron in NodeWorx ===================================================== 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. Theiworx 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. How to: view a system user's crontab file ----------------------------------------- #. Click the **Server** menu item if it is not already open. #. Click the **CRON** menu item. #. Locate the **User:** drop-down menu. #. 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. #. You will now see the chosen user's crontab in the fields below. #. From here you may choose to add new CRON jobs, edit or delete existing CRON jobs, or edit CRON variables. How to: Manage a system user's crontab options ---------------------------------------------- #. Click the **Server** menu item if it is not already open. #. Click the **CRON** menu item. #. Choose the user whose crontab you would like to edit from the **User:** drop-down menu. #. You will now see the chosen user's crontab, and the various CRON options, in the fields below. #. Change the option(s) you wish to update to the desired value(s). #. Click the Update button. 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. How to: Set a cron job ---------------------- #. Click the **Server** menu item if it is not already open. #. Click the **CRON** menu item. #. 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 Add button to add the CRON job. 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 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ #. 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). #. 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). #. 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). #. 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). #. 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. #. Set the Script command you would like to run. #. Click the Add button to add the CRON job. 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. 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 Week Every 5 All All All All ======= ==== === ===== ==== Advance Interface """"""""""""""""" ====== ==== === ===== ==== Minute Hour Day Month Week \*/5 \* \* \* \* ====== ==== === ===== ==== Example 2: Yearly ^^^^^^^^^^^^^^^^^ Run yearly (at exactly midnight on January 1st). Simple Interface """""""""""""""" ====== ======== === ===== ==== Minute Hour Day Month Week 0 Midnight 1 Jan All ====== ======== === ===== ==== Advance Interface """"""""""""""""" ====== ==== === ===== ==== Minute Hour Day Month 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 Week 15 2AM 5 ALL All ====== ==== === ===== ==== Advance Interface """"""""""""""""" ====== ==== === ===== ==== Minute Hour Day Month Week 15 2 5 \* \* ====== ==== === ===== ==== Example 4: Weekly ^^^^^^^^^^^^^^^^^ Run weekly (at 4:32PM on every Thursday). Simple Interface """""""""""""""" ====== ==== === ===== ==== Minute Hour Day Month Week 32 4PM All All Thu ====== ==== === ===== ==== Advance Interface """"""""""""""""" ====== ==== === ===== ==== Minute Hour Day Month Week 32 16 \* \* 4 ====== ==== === ===== ==== Example 5: Daily ^^^^^^^^^^^^^^^^ Run daily (at 12:45AM every day). Simple Interface """""""""""""""" ====== ======== === ===== ==== Minute Hour Day Month Week 45 Midnight All All All ====== ======== === ===== ==== Advance Interface """"""""""""""""" ====== ==== === ===== ==== Minute Hour Day Month Week 45 0 \* \* \* ====== ==== === ===== ==== Example 6: Hourly ^^^^^^^^^^^^^^^^^ Run hourly (at 24 minutes past the hour). Simple Interface """""""""""""""" ====== ==== === ===== ==== Minute Hour Day Month Week 24 All All All All ====== ==== === ===== ==== Advance Interface """"""""""""""""" ====== ==== === ===== ==== Minute Hour Day Month 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 Week 52 Every 4 All All All ====== ======= === ===== ==== Advance Interface """"""""""""""""" ====== ==== === ===== ==== Minute Hour Day Month 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 Week 8, 22, 47 2AM, 2PM All Jan, Apr, Aug, Dec All ========= ======== === ================== ==== Advance Interface """"""""""""""""" ======= ==== === ===== ==== Minute Hour Day Month Week 8,22,47 2,14 \* \*/3 \* ======= ==== === ===== ==== How to: Edit a Cron Job ^^^^^^^^^^^^^^^^^^^^^^^ #. Click the **Server** menu item if it is not already open. #. Click the **CRON** menu item. #. Choose which user's crontab you would like to edit. #. Click the **[ Edit ]** link next to the CRON job you would like to edit. #. Edit the CRON job. #. Click the Save button to update the CRON job. How to: Delete a Cron Job ------------------------- #. Click the **Server** menu item if it is not already open. #. Click the **CRON** menu item. #. Choose the user whose crontab you would like to edit from the **User:** dropdown menu. #. You will now see the chosen user's crontab in the fields below, with a checkbox next to each cronjob. #. 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. #. 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. 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. The InterWorx crons are located at ~iworx/cron 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: - Checks for OS and InterWorx Updates. - stats - runs through all domains and enabled 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 """""""""""""""""" Currently not used. iworx.pex --monthly """"""""""""""""""" Currently not used.