What are CRON Jobs?
Cron is a service provided by most hosters – including Godaddy, Dreamhost, Hostgator, etc… that allowes you to run sheduled jobs to perform regular cleanups, backups or other scripts that need to run from time to time.
Why would you need that?
PHP is running only when users are visiting your site. You have no guarantee that at a specific time there will be an instance of PHP running on your webserver. This is why you have to ensure this through running at specific times the needed PHP script.
What “The Factory” Extensions need Cron jobs?
Auction Factory Reverse Auction Factory Raffle Factory |
|
Ads Factory |
|
jAnswers Factory |
|
Love Factory |
|
RSS Factory RSS Factory PRO |
|
What job should be executed for a specific Extension?
That depends on several factors: does your hosting service allow lynx, curl or wget to be executed in cron? If not, then you can execute the PHP script directly with the php binaries. At least one of these three options must be enabled for you in your hosting. If none works, then you should ask your hoster to enable at least one of it, since it’s a common practice for websites to use these techniques.
Lynx and wget are some sort of text web browsers in linux that help us access a web link as any other user would do. This is why all our CRON scripts are password protected. Some scripts have the password in the script itself, similar to:
//Change the password in the next line
define('AUCTIONS_CRON_PASSWORD','pass');
Other extensions like “RSS Factory” and “RSS Factory PRO” have the password stored in the admininstrator backend.
If you use lynx or wget, the cron job will access the script url as see in any browser. For instance : http://[yourserver]/components/com_bids/cron_action.php
Since we do not need to see the output of the script, we will inhibit the output from the call. This is why we will route the output of this command to /dev/null
Below is the list of CRON Jobs using lynx, curl or wget. If your hosting allowes only direct PHP call then read the next section. You must use just ONE of the three calls sampled here. We included all three types of calls in order to cover all types of hosting.
Auction Factory |
lynx -accept_all_cookies –dump 'http://[yoursite]/components/com_bids/cron_action.php?pass=[yourpass]' |
wget -O - -q 'http://[yoursite]/components/com_bids/cron_action.php?pass=[yourpass]' |
curl --silent –compressed 'http://[yoursite]/components/com_bids/cron_action.php?pass=[yourpass]' |
Reverse Auction Factory |
lynx -accept_all_cookies –dump 'http://[yoursite]/components/com_rbids/cron_action.php?pass=[yourpass]' |
wget -O - -q 'http://[yoursite]/components/com_rbids/cron_action.php?pass=[yourpass]' |
curl --silent –compressed 'http://[yoursite]/components/com_rbids/cron_action.php?pass=[yourpass]' |
Raffle Factory |
lynx -accept_all_cookies –dump 'http://[yoursite]/components/com_bids/cron_action.php?pass=[yourpass]' |
wget -O - -q 'http://[yoursite]/components/com_bids/cron_action.php?pass=[yourpass]' |
curl --silent –compressed 'http://[yoursite]/components/com_bids/cron_action.php?pass=[yourpass]' |
Ads Factory |
lynx -accept_all_cookies –dump 'http://[yoursite]/components/com_adsman/cron_adsman.php?pass=[yourpass]' |
wget -O - -q 'http://[yoursite]/components/com_adsman/cron_adsman.php?pass=[yourpass]' |
curl --silent –compressed 'http://[yoursite]/components/com_adsman/cron_adsman.php?pass=[yourpass]' |
jAnswers Factory |
lynx -accept_all_cookies –dump 'http://[yoursite]/components/com_jooanswers/cron_action.php?pass=[yourpass]' |
wget -O - -q 'http://[yoursite]/components/com_jooanswers/cron_action.php?pass=[yourpass]' |
curl --silent –compressed 'http://[yoursite]/components/com_jooanswers/cron_action.php?pass=[yourpass]' |
Love Factory |
lynx -accept_all_cookies –dump 'http://[yoursite]/components/com_lovefactory/cron_action.php?pass=[yourpass]' |
wget -O - -q 'http://[yoursite]/components/com_lovefactory/cron_action.php?pass=[yourpass]' |
curl --silent –compressed 'http://[yoursite]/components/com_lovefactory/cron_action.php?pass=[yourpass]' |
RSS Factory |
lynx -accept_all_cookies –dump 'http://[yoursite]/index.php?option=com_rssfactory&task=refresh&password=[yourpass]' |
wget -O - -q 'http://[yoursite]/index.php?option=com_rssfactory&task=refresh&password= [yourpass]' |
curl --silent –compressed 'http://[yoursite]/index.php?option=com_rssfactory&task=refresh&password= [yourpass]' |
RSS Factory PRO |
lynx -accept_all_cookies –dump 'http://[yoursite]/index.php?option=com_rssfactory&task=refresh&password=[yourpass]' |
wget -O - -q 'http://[yoursite]/index.php?option=com_rssfactory&task=refresh&password= [yourpass]' |
curl --silent –compressed 'http://[yoursite]/index.php?option=com_rssfactory&task=refresh&password= [yourpass]' |
Several extensions need two types of jobs – Daily and every 5-10 minutes. The daily job checks actions that have to be triggered at midnight (for instance auction expiring). The normal job will check the current environment and act accordingly ( for instance check if auctions expired). For Daily jobs you have too append ‘&daily=1’ to the url. Example:
'http://[yoursite]/index.php?option=com_rssfactory&task=refresh&password= [yourpass]&daily=1'
Extensions that require daily jobs:
- Auction Factory
- Reverse Auction Factory
- Raffle Factory
- Ads Factory
- jAnswers Factory
- Love Factory
Extensions that require normal jobs (all 5-10 minutes):
- Auction Factory
- Reverse Auction Factory
- Raffle Factory
- Ads Factory
- jAnswers Factory
- RSS Factory
- RSS Factory PRO
For users that have hostings that do not allow execution of curl, wget or lynx will have to execute the PHP directly as a command line. Most times the php interpreter is in the search path of the hosting, so you do not have to prefix the php with it’s path. Mostly php is located in /usr/bin or in /usr/local/bin. In order to execute a php script you should write for instance: /usr/bin/php [path-to-the-script]/script.php To be more specific you can check the following list. You have to know the installation path of your joomla site (not the URL! It has to be something like /home/myhosting/public_html/joomla )
Auction Factory |
php [install-path]/components/com_bids/cron_action.php pass=[yourpass] |
Reverse Auction Factory |
php [install-path]/components/com_rbids/cron_action.php pass=[yourpass] |
Raffle Factory |
php [install-path]/components/com_bids/cron_action.php pass=[yourpass] |
Ads Factory |
php [install-path]/components/com_adsman/cron_adsman.php pass=[yourpass] |
jAnswers Factory |
php [install-path]/components/com_jooanswers/cron_action.php pass=[yourpass] |
Love Factory |
php [install-path]/components/com_lovefactory/cron_action.php pass=[yourpass] |
RSS Factory |
Not available in the current version |
RSS Factory PRO |
Not available in the current version |
To run daily jobs you have to append “daily=1” to the command. Example:
php [install-path]/components/com_jooanswers/cron_action.php pass=[yourpass] daily=1
Note: Please mind the Apostroph before the URLS in the commands involving lynx, wget and curl.
Note: If the jobs do not seem to work, please try to find in your hosting help, or ask support if they support these calls.