The tasks2.php script has one primary function, it executes the automation rules defined in Admin->Tools->Automation Rules.
Each time tasks2.php runs all Automation Rules are run.
Automation rules allow you to define a set of conditions and when a request or requests meet those conditions to perform one or more actions on the matching requests.
The tasks2.php file is in the root HelpSpot folder. The same one which contains admin.php and index.php.
Version 3 of HelpSpot defaulted to run tasks2 once per day. However, as of Version 4, we recommend running tasks2 once per minute. Because automation rules are often based on checking time-based criteria (e.g. no one has replied in 60 minutes), checking the automation rules every one minute often makes the most sense.
It's also possible to run a rule on it's own time schedule as described below.
On Linux/Unix the script should be run via Cron. On Windows Scheduled Tasks should be used. Windows users note that if you've installed using our Windows Installer a scheduled task has already been setup for you.
Configuration for Windows:
The Windows Installer configures this scheduled task for you.
Configuration for Linux/Unix/OSX:
tasks2.php can be called directly through PHP on the command line or via an HTTP call. Several examples are below, but be sure to replace the generic paths with the ones for your installation:
Direct command line method for every minute (preferred):
* * * * * /usr/bin/php /path/to/helpspot/tasks2.php
Using HTTP with curl:
* * * * * curl http://www.domain.com/tasks2.php
In some cases you may want to run a rule more often then the default tasks2.php schedule.
For example, a rule which escalates a request if it's been unanswered for more than 4 hours. In this case you would need to run the rule every few minutes to escalate the requests as soon as they turn 4 hours old.
To run just one rule via tasks2.php you need to know the rules ID. You can find the ID for an automation rule in Admin->Tools->Automation Rules
If you were using the HTTP method you would change the URL to:
If you were using the command line CRON method you would do this:
* * * * * /usr/bin/php /path/to/helpspot/tasks2.php --id=3
On windows you will use a bat file and call that bat from windows task scheduler. Here is a sample bat file:
@echo off "C:\Program Files (x86)\helpspot\php\php.exe" -c "C:\Program Files (x86)\helpspot\php\php.ini" "C:\Program Files (x86)\helpspot\helpspot\tasks2.php" --id=20