How To: Manage Scheduled Tasks Using Crons in NodeWorx ====================================================== InterWorx provides the NodeWorx administrator the ability to control every unix user's crontabs directly from the browser interface. For security purposes, the ability to edit the root and iworx user crontabs via Nodeworx is disabled. For information on how to enable the edit feature for these specific crontabs, see `To Enable GUI Edit Permissions For the root and iworx User Crontabs`_. .. contents:: To View a User's Crontab File ----------------------------- #. Log into NodeWorx from the browser (https://ip.ad.dr.ess:2443/nodeworx) #. Navigate to **Server > Cron** #. From the **User** dropdown, select a **unix user** .. image:: /images/cron-manage.png :alt: crontab To Edit a User's Crontab Options -------------------------------- #. Log into NodeWorx from the browser (https://ip.ad.dr.ess:2443/nodeworx) #. Navigate to **Server > Cron** #. From the **User** dropdown, select a **unix user** .. image:: /images/nw-cron-options.png :alt: cron options #. Under Cron Options, click the **Pencil**. This opens the Cron Options Form #. Make the desired changes. There are three options that can be managed from this form: - **Shell**: All scripts will be executed with this shell - The default shell is /bin/sh - **Path**: Sets the directories which will be used in the search path for the cron - **Mailto**: Output produced by a Cronjob will be emailed to this address .. image:: /images/cron-options-form.png :alt: cron options form #. Click **Update** To Set a New Cron Job --------------------- #. Log into NodeWorx from the browser (https://ip.ad.dr.ess:2443/nodeworx) #. Navigate to **Server > Cron** #. From the **User** dropdown, select a **unix user** .. image:: /images/cron-manage.png :alt: crontab #. Under Cron Editor, click the **vertical dots** icon #. Select either **Simple Interface** or **Advanced Interface** - Each interface provides the same options, just different input methods: - **Simple Interface**: Provides a visual guide for each required field, using words and numbers - **Advanced Interface**: Allows the user to manually update the required fields, using numeric notation, similar to editing the crontab from the CLI .. image:: /images/cron-interfaces.png #. Update the required fields: - **Minute**: The minute the cron will run - Can be set as a specific minute (8 is the 8th minute of every hour), an interval (every 2, 5, 10, or 15th minute), a range (5-10 is minutes 5 through 10), or every minute (ALL in the Simple Interface, or * in the Advanced Interface) - **Hour**: The hour the cron will run - Can be set as a specific hour (10PM is every day at 10PM or 22 is every day at 10PM), an interval (every 2, 4, or 6th hour), a range (5-10 is hours 5AM through 10AM), or every hour (ALL in the Simple Interface, or * in the Advanced Interface) - **Day**: The day of the month the cron will run - Can be set as a specific day between 1 and 31 (12 is the 12th day of every month), a range (1-15 is days 1 through 15), an interval (\*/3 is every 3 days in the Advanced Interface), or every day (ALL in the Simple Interface, or * in the Advanced Interface) - **Month**: The month the cron will run - Can be set as a specific month between 1 and 12 (Feb is every February in the Simple Interface, 2 is every February in the Advanced Interface), a range (5-7 is months May through July), an interval (\*/2 is every two months in the Advanced Interface), or every month (ALL in the Simple Interface, or * in the Advanced Interface) - **Day of the Week**: The day of the week the cron will run - Can be set as a specific day of the week between 0 and 7 (Wed is every Wednesday in the Simple Interface, 3 is every Wednesday in the Advanced Interface), a range (1-3 is days Monday through Wednesday), an interval (\*/2 is every 2 days of the week in the Advanced Interface) or every day of the week (ALL in the Simple Interface, or * in the Advanced Interface) - Both 0 and 7 may be used to represent Sunday - **Script**: The script that will run as part of the cron #. Click **Add** To Edit a Cron Job ------------------ #. Log into NodeWorx from the browser (https://ip.ad.dr.ess:2443/nodeworx) #. Navigate to **Server > Cron** #. From the **User** dropdown, select a **unix user** .. image:: /images/cron-manage.png :alt: crontab #. Under Cron Editor, click the **Pencil** next to the Cronjob to edit. This opens the Edit Cron Job form #. Update the desired fields .. image:: /images/cron-edit-form.png :alt: cron edit form #. Click **Save** To Delete a Cron Job -------------------- #. Log into NodeWorx from the browser (https://ip.ad.dr.ess:2443/nodeworx) #. Navigate to **Server > Cron** #. From the **User** dropdown, select a **unix user** .. image:: /images/cron-manage.png :alt: crontab #. Under Cron Editor, click the **Trashcan** next to the Cronjob to delete - To delete multiple Cronjobs at one time, select the checkboxes next to the Cronjobs to be deleted and then click **Go** next to the With Selected dropdown InterWorx-specific Cronjobs --------------------------- The InterWorx cron jobs are extremely critical to the InterWorx control panel system. They are assigned to the ``iworx`` unix user, and manage such tasks as disk and bandwidth quota enforcement, problem detection, compiling stats, making sure the license is synchronized, etc. They should not be deleted or edited unless there is a specific reason to do so. .. image:: /images/cron-iworx-cron.png :alt: iworx cron jobs - **Fively**: Runs every 5 minutes - Updates rrd graphs - Updates DNS - Cleans up empty session fields - Syncs scheduled backups - Kills stranded processes - Updates and applies changes to SiteWorx PHP versions - Checks for clustering - Calculates bandwidth and storage calculations if the ~iworx/iworx.ini is set to runtime=fively (default setting) - **Fifteenly**: Runs every 15 minutes - Retries failed upgrade steps - Calculates bandwidth and storage calculations if the ~iworx/iworx.ini is set to runtime=fifteenly - **Hourly**: Runs every hour - Checks that localhost is listed in hosts file - Deletes expired items in the cache - Calculates bandwidth and storage calculations if the ~iworx/iworx.ini is set to runtime=hourly - **Quad_daily**: Runs 4 times a day (every 6 hours) - Installs hotfixes - Pings license.interworx.com to sync the InterWorx license - Updates the System Health page in NodeWorx - Calculates bandwidth and storage calculations if the ~iworx/iworx.ini is set to runtime=quad_daily - **Daily**: Runs daily - Syncs storage quotas - Checks for OS and InterWorx Updates - Backs up the InterWorx Database - Runs AutoSSL process - Checks for Let's Encrypt SSL certificate renewals - Spam Assassin training - uses "sa-learn" to train messages in users' Learn Spam / Learn Ham folders - Bayes training - Cleans up pending, malformed SiteWorx accounts - Rotates InterWorx logs - Calculates stats - Calculates bandwidth and storage calculations if the ~iworx/iworx.ini is set to runtime=daily - **Midnight**: Runs daily at midnight - Checks for dated domain-level error and transfer logs - Creates each new day's dated domain-level error and transfer logs - **Weekly**: Runs weekly - Updates usage data - Confirms that domain SSL certificates are up to date - **Monthly**: Currently not used To Enable GUI Edit Permissions For the root and iworx User Crontabs ------------------------------------------------------------------- For security purposes, while the crontab for the root and iworx users can be edited at the CLI, the ability to edit these crontabs via Nodeworx is disabled. This behavior can be changed using an environment flag. #. Log in to the server at the CLI as root, either via SSH or from the terminal #. At the CLI, run the following to create the environment flag .. code-block:: touch ~iworx/etc/env/cron-edit-allow-all