Cron Jobs Overview
The ‘Email Updates’ options are available to enable/disable in the IProperty Settings Panel, in the Properties and Advanced Search areas respectively. If both of these options are set to No, then the email updates will not function regardless of whether you create a cron job as detailed below.
What is Cron and how does IProperty use it?
Cron is simply a system-level utility found in most server software that allows users to schedule tasks. You can set cron to fire a given task on almost any schedule you desire – every second, minute, hour, day, or every third Sunday. In the IProperty use case, updating users to notify them of new search results or modifications to their saved property updates, we recommend at most to run the job once a day.
For the purpose of this discussion, we’ll assume that we’re going to run the job once a day, at 2am, and send both saved search updates and saved property updates.
To put it simply, all we’re going to do with cron is to request a page from your IProperty site. That page will then perform the queries, create the emails and send the updates for you. To prevent malicious users from simply requesting this page to tie up your server resources and annoy your users, you will pass in a hash of the $secret from your Joomla site as a Key. We hash the key as a precaution against a “man in the middle” attack, so that even if a hacker had access to the network traffic, he would not be able to get your site’s secret variable.
Let’s get started!
You will need to take a look at your Joomla configuration.php file, and copy the $secret variable (it will look something like this: tiEt58hN6LCbB0rk). We’re then going to create an MD5 hash of this value. You can generate an MD5 hash using a simple PHP script, or you can access an online MD5 generator like the one found here.
Simply plug in your site secret (without the single quotes!) and copy the resulting hash.
The format of the URL to request via the cron job is as follows:
You can set listing = true to send saved property updates
You can set search = true to send saved search updates.
If both of these values are absent or set to false, then no updates will be sent.
Set X to the maximum number of listings to send in a search update. We recommend about 25. Any more than that and the email becomes awkward to read.
Set secret = your MD5-hashed secret.
In most cases, you will simply use the UNIX/LINUX utility WGET to request the page from your server. However, there are other alternatives, including using Lynx or cURL. These alternate approaches may be required depending on your host. Again, check with your hosting support for more information on the best way to request the URL via cron.
An example of how you’d set up your cron job using a command-line cron interface.