HDesk Blog

Setting up cron jobs

Posted in: Tutorials
Sep 29, 2009

About crons

Actually it is called 'cron daemon'. Cron is an automatic task machine. You will use it on your Unix or Linux operating systems for doing some tasks at specific intervals with out your intervention every time. You set the clock and forget. The cron daemon runs the work for you.

Why do you need crons

After adding email queues you will need to have a cron set up on the parser file which analyzes the emails and decides what to do with them. The cron is required to enable email to email communication because Hdesk needs to be executed at every x times in order to check for new emails, apply parser rules to your incomming etc.

To add a new cron you will have to log into your server's control panel and look for the section called "Cron tabs", "Cron jobs" or "Scheduled tasks". You must create a new cron for each email queue in part. This allows you to fetch emails from the provided accounts in your email queues. Please consider the following tutorials for guiding on how to setup a cron in different control panels:

Plesk: http://www.parallels.com/doc/tutorials/Plesk/Plesk7/plesk_plesk7_eu/plesk7_eu_crontab.htm
Cpanel: http://glurt.com/cron-cpanel-tutorial

The cron should access
/path/to/various/modules/tickets/fetch.php 1


1 represents the id of the email queue you wish to fetch emails from. Check your email queues page for the Id's. If you are fetching emails using email piping, there's no need to put a cron on that email queue, only for pop/imap fetching. We recommend setting this cron to run every 5 minutes or less depending on you site's activity.

Now that we managed to get our incoming emails into the system, it's time for you to run the parser which decides what goes where based on existing parser rules. If no parser rules are added, the parser script will simply add the emails to the specified department in the email queue.

The parser cron should access
/path/to/various/modules/tickets/parser.php


You don't have to specify any queue id in the parser cron as the emais are already into our system. This cron should be set only once, not for every email queue like we did with fetch.php.

Recommended cron interval: 5 minutes