HomeAdmin ManualHelpSpot 4 - Installation & SetupTasks.php Explained

11. Tasks.php Explained

AS OF HELPSPOT 5.0 TASKS.PHP IS NO LONGER USED

See documentation here on the new cron jobs and and queuing system

What does tasks.php do?

The tasks.php script has 3 main functions in HelpSpot:

  1. Check email accounts and convert emails into requests
  2. Send out reminders
  3. Delete requests marked as trash

Running tasks.php on a regular basis is critical to using HelpSpot. Major functionality will not work properly without this script running.

Where is it located?

The tasks.php file is in the root HelpSpot folder. The same one which contains admin.php and index.php.

How often should tasks.php run?

Every 1-5 minutes, however every 1-2 is recommended.

How do I run the script?

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:
If you've used the HelpSpot Windows Installer this has already been done for you.

Configuration for Linux/Unix/OSX:
tasks.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/tasks.php

Using HTTP with curl:

* * * * * curl http://www.domain.com/tasks.php

Tips and Tricks

Direct access
You can manually run the tasks.php file in your browser to force it to pull in email (and it's other actions). This is often useful for testing purposes. Just visit the script in your browser at http://www.domain.com/tasks.php. Note that it is normal for the output to be a blank white screen.

Tasks.php debugging
If you're having problems with an email account it can be useful to turn on tasks.php debugging in Admin->Settings->Email Integration. Once this is on if you visit the tasks.php file in your browser (as described above) you'll see debugging output. It's often useful to do "view source" in your browser to see the output in a nicer format.

Additional security
If you want to prevent people from outside being able to access tasks.php via HTTP you can set the IP's that are allowed to call it in Admin->Settings->System.

Check just one mailbox
Normally each time tasks.php is run it checks all mailboxes you've configured in Admin->Mailboxes. If you'd like to run mailboxes on their own checking schedules though it's possible to have HelpSpot only check one mailbox when tasks.php is run. To do so you need to pass in the ID of the mailbox which you can find in Admin->Mailboxes.

If you were using the HTTP method you would change the URL to:

http://www.domain.com/tasks.php?id=4

If you were using the command line method you would do this:

* * * * * /usr/bin/php /path/to/helpspot/tasks.php --id=4

 

New in HelpSpot version 4: Check multiple mailboxes

Customers with many Email Mailboxes (or a few which usually contain large attachments) may want to divide mailboxes out to separate scheduled tasks. This allows you to stagger when they are called, or to separate email mailbox checking to multiple PHP calls. This reduces the change of hitting an error due to meeting memory limits while checking for new email.

For example, if you have 6 Email Mailboxes (of id 1, 2, 3, 4, 5, and 6) configured and want to check 3 at a time, you can create two tasks. 

If you were using the HTTP method you would make 2 separate calls like so:

http://www.domain.com/tasks.php?id[]=1&id[]=2&id[]=3
http://www.domain.com/tasks.php?id[]=4&id[]=5&id[]=6

If you were using the command line method you make 2 separate crontasks like so:

* * * * * /usr/bin/php /path/to/helpspot/tasks.php --id=1,2,3
* * * * * /usr/bin/php /path/to/helpspot/tasks.php --id=4,5,6

 

Knowledge Tags

This page was: Helpful | Not Helpful