You must create cron tasks in order to automate tasks within WHASOLS.

The cron is a system daemon used to execute tasks at designated times. WHASOLS includes processes that must run on a periodic basis via the cron.

Setting up the Cron Tasks

System Cron
The system cron automates tasks within WHASOLS. Configure this to use the appropriate frequencies:

Every 5 minutes, or as frequently as your hosting provider allows (minimum once per hour).

Sample Cron Command
*/5 * * * * php -q /home/your-domain-directory-name/cron.php

 
You can find the correct command to copy-and-paste for your WHASOLS installation by navigating to Configuration > Automation Settings and clicking on the first badge.
Most hosting control panels provide a simple user interface for creating cron jobs.

POP Email Import Cron
This cron task is only required if you wish to import emails to the support queue via the POP3 protocol. (We recommend using Email Piping instead.) If you use this, configure it to run every five minutes.

Sample Cron Command
*/5 * * * * php -q /home/your-domain-directory-name/pipe.php

The above example will run the POP3 email import task every five minutes.

Change of Daily Cron Hour
You can change the time at which the daily automated actions run using the Time of Day setting. For more information, see Automation Settings.

WHASOLS uses the PHP 24 Hours based timestamp when the Cron script runs. This determines the current Time of Day based on the value that the PHP configuration returns applied to the Cron execution.

We recommend executing the cron task every 5 minutes. WHASOLS will never perform a particular task more frequently than they are listed here. You can set the cron file to run every 5 minutes without any duplication.

If you only want to execute crons at the "Time of Day" hour, ensure that WHASOLS configured time zone matches the server's time zone. For more information, see Changing_Timezone.

The cron must execute the crons file within the hour that you set in WHASOLS's automation settings. If it does not, the daily automated tasks will not run.


System Cron
The system cron (php -q /home/your-domain-directory-name/cron.php) automates tasks within WHASOLS. This script can run with several optional values. This allows very specific control of the tasks that run and the script's output. Most WHASOLS installations only require an entry that invokes the system cron script (php -q /home/your-domain-directory-name/cron.php).

Arguments
The cron script includes three essential and supporting arguments:
  • /dev/null 2>&1   perform as email email report not sent to admin email address
  • cmd=all — Attempt to perform all due automation tasks. If you do not provide input, this argument is applied by default.
  • cmd=skip — Perform all tasks (in the same way as the all argument) but exclude tasks that you specify.
  • cmd=do — Only perform the tasks that you specify.
  • cmd=help — Lists help and options for the argument you specify.
  • cmd=list — Lists all possible arguments.
Output
The System Cron will not generate any success console output by default. Use the verbosity options if you require progressive completion information while attending the manual execution of System Cron invocation.

The System Cron will, by default, generate a Digest Email Report when performing the "Daily" group of tasks. This report can be forcibly generated for any particular invocation with the  report. The Digest Email Report will only contain information related to that execution and will not contain aggregate information from prior executions. Please visit the Automation Status page in your Admin area to get an overview of daily aggregated work.

Tasks
All routines of system cron (php -q /home/your-domain-directory-name/cron.php) are tasks. Most tasks are daily, and should only be run once a day. Some tasks benefit from running multiple times a day, such as ticket escalations or checking for WHASOLS Updates. Other tasks should only run once a month, such as calculating overage usage and generating the respective invoices.

Types
There are two types of tasks:

  • Application: Advances state of client data, such as orders, billing, and provisioning
  • System: Provides software related functionality, such as generating backups or performing database normalization.
    • The "DatabaseBackup" task is the only task option of the System type which can be included/excluded from execution. All other System type task options will be performed explicitly as required by WHASOLS and thus do not have option flags.

Advanced Task Scheduling
In some environments or use-cases, having fine-grained control of one or more tasks is important. This is possible through a combination of multiple do and skip crontab entries. Tasks performed as part of a do command will not have their internal scheduling tracking modified. This is to ensure the integrity of a normal invocation of the System Cron. If you want a particular task to only execute on a particular schedule, create a do command for that task and alter your main System Cron invocation to skip that task (all other non-itemized tasks will be performed on the WHASOLS schedule in this skip). Likewise, if you never wish to have a particular task executed, alter your System Cron entry to be a skip command with the option for that particular task.

Hook Points
The System Cron has six hook events:

PreCronJob
  • Fires only during the daily cron run
  • Is invoked before any tasks are executed
  • Registered hooks receive no parameter arguments

PreAutomationTask
  • Is invoked before each Application task
  • Registered hooks receive one parameter argument:
  • The task object that is about to be executed.
  • The return value of this hook is not inspected. However, if an exception is thrown, the task will not be executed, be marked as incomplete, and iteration to the next task will commence
PostAutomationTask
  • Is invoked after each Application task
  • Registered hooks receive two parameter arguments:
  • The task object that was just executed.
  • The boolean state if the task executed without throwing an Exception
  • The return value of this hook is not inspected. Any Exception thrown will be discarded
DailyCronJobEmail
  • Fires during the daily cron run or when &email-report=1 is specified
  • Is invoked after all Application tasks are executed, immediate prior to the DailyCronJob hook
  • If a registered hook returns true, the digest email report will not be sent
  • Registered hooks receive no parameter arguments
DailyCronJob
  • Fires only during the daily cron run
  • Is invoked after all Application tasks are executed, immediate proceeding the DailyCronJobEmail hook
  • Register hooks receive no parameter arguments
AfterCronJob
  • Fires each time cron is invoked
  • Is invoked after all Application & System tasks are executed, just prior to script termination
  • Registered hooks receive no parameter arguments
Example Crontab Entries
Below are examples that demonstrate the flexibility of the System Cron input options and how you could craft your crontab entry. For most WHASOLS installation, you should just have one entry (Ex. 1). If you wish to disable certain tasks entirely, consider looking at the related functionality's documentation first to understand how your may be able optimize your WHASOLS settings from the administration area and potential avoid unnecessary crontab entries.

Ex 1. Standard System Cron entry:

*/5 * * * * php -q /home/your-domain-directory-name/cron.php >/dev/null 2>&1

Ex 2. Explicit entry to perform all scheduled task if they are due (will behave the same as Ex. 1):

*/5 * * * * php -q /home/your-domain-directory-name/cron.php /all >/dev/null 2>&1


Ex 3. Always skip sending domain renewal notices, but perform all other tasks as normal if they are due:

*/5 * * * * php -q /home/your-domain-directory-name/cron.php cmd=skip tasks=InactiveClients,CurrencyExchangeRates >/dev/null 2>&1


Ex 4. Always skip ticket escalations and auto suspensions. Process ticket escalations Monday-Friday during business hours, at the top of the hour, and auto suspension Monday-Friday at the start of business:

0 9,10,11,12,13,14,15,16 * * 1-5 php -q /home/your-domain-directory-name/cron.php cmd=skip tasks=InactiveClients,CurrencyExchangeRates  >/dev/null 2>&1

0 9 * * 1-5 php -q /home/your-domain-directory-name/cron.php cmd=skip tasks=CurrencyExchangeRates  >/dev/null 2>&1

Ex 5. In some hosting environments, direct crontab entries are not permitted. The System Cron can be invoked through an HTTP request (provided the script is accessible within the docroot) The follow demonstrates performing all tasks except DomainRenewalNotices and TicketEscalations
0 9 * * 1-5 wget -q -O - https://example.com/cron.php?cmd=skip&tasks=InactiveClients,CurrencyExchangeRates >/dev/null 2>&1

GET http://www.example.com/cron.php?cmd=skip&tasks=DomainRenewalNotices,TicketEscalations
Legacy Cron File Locations
All cron files are now located in the includes/crons directory by default.

Cron Tasks List:
  1. InvoicesLateFeesAddition
  2. AffiliateCommissions
  3. AffiliateReports
  4. InactiveClients
  5. OverdueTerminations
  6. ProcessedCancellations
  7. ClosedInactiveTickets
  8. InvoicesAutoGeneration
  9. CreditCardExpiryNotices
  10. CurrencyExchangeRates
  11. ProductPricingUpdates
  12. DomainRenewalNotices
  13. FixedTermTerminations
  14. InvoiceOverdueReminders
  15. OverdueSuspensions
  16. TicketEscalations
  17. UpdateDomainExpiryStatus
  18. ServerUsageStats
  19. RunJobsQueue
  20. DataRetentionPruning
  21. DomainStatusSync
  22. DomainTransferSync
  23. SslStatusSync
  24. AutoPruneTicketAttachments
  25. ProcessEmailQueue
  26. UnSuspendServices
  27. InvoicesCancelled
  28. DatabaseBackup
  29. DataNormalization
  30. AccountStatement
  31. SmsSent