Logo

This is an old revision of the document!


CRON Job Settings for thePHPfactory Extensions


Most of our extensions have the required information available in the administrator backend, and also the required links. You can check individual documentation or the component control panel for links, password setup and other details. If still having trouble, continue with this article or use our forum.


What are CRON Jobs?


CRON is a service provided by most hosting solutions – including Godaddy, Dreamhost, Hostgator, etc… that allows you to run scheduled jobs that perform regular cleanups, backups or other scripts that need to run from time to time.

Why do you need a CRON Job?


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 web server. This is why you have to ensure this through running at specific times the needed PHP script.


CRON jobs are tasks that run at scheduled times, where usually this is a service offered by the hosting provider. These tasks make sure that certain extension tasks run at a specific time. This way you make sure that for instance your users get the notifications about upcoming expiring auctions or information regarding their watchlists.

CRON jobs are required to keep an extension working properly. For detailed information about what each component needs a CRON for, check the detailed link at the bottom of this article.

Where do i set up my CRON Jobs?


Setting up the CRON jobs might be different from one solution to another, since this depends allot on the service provider. Here we advise to check out our references and match them to the ones provided by your hosting provider or other 3rd party which is offering the CRON service.


What tasks do i set up in my CRON Jobs?


There are two tasks that must run:

  • Common task that may run every 5-15 minutes, that closes current expiring auctions and notifies winners/auctioneers.
  • Daily task that runs once a day, which takes care of cleanups, updates the exchange rates for currencies and notifies users of upcoming auctions (in the next 24 hours)

Our recommendation is to set up the common at a 5 minutes pace and the daily at midnight.


You can find exact links for your site by going to the component Settings - CRON Information



These are the links you must set up to be accessed in CRON, for documentation purposes we only show the links for Auction Factory:


  • Common task: [Yoursite]/index.php?option=com_auctionfactory&controller=crontask&pass=
  • Daily task: [Yoursite]/index.php?option=com_auctionfactory&controller=crontask&daily=1&pass=


You can set up / change the password for the CRON jobs in Settings - General Settings, first tab - CRON Settings area.


Detailed CRON information for all our extension can be found at this link.


Which "thePHPfactory" Extensions need Cron jobs?


Component CRON Job
Auction Factory

Reverse Auction Factory

Dutch Auction Factory

Penny Auction Factory

Raffle Factory

Jobs Factory

Closes Expired Auctions/Raffles/Jobs and sends mail alerts to the involved parties (notification of chosen winner, notification to losing parties, notification to auctioneer)
Notify about Auctions/Raffles/Jobs about to expire in user Watchlists
Chooses winners for automatic Auctions/Raffles
Closes auctions from deleted users
If enabled purges auctions that are archived longer than X months
Processes CRON in payment items (if needed for a specific payment item)
Updates currency exchange rates

Ads Factory

Swap Factory

Closes Expired Ads and sends mail alerts to the involved parties (Ads owner, users that added the ad in the favorites)
Notify about Ads about to expire in users Watchlist/Favorites
Closes Ads from deleted users
If enabled purges Ads that are archived longer than X months
Processes CRON in payment items (if needed for a specific payment item)
Cancel offers that contain swapped/closed/expired items
Notify about upcoming offer expiration if one of the ads is about to expire
Manages currencies by converting users balance and all payment items to default currency, as well as updating categories price for all payment items

jAnswers Factory
Closes Expired Questions and sends mail alerts to the involved parties (Question owner, users that added the question in the favorites, users that answered the question)
Notify about Questions about to expire in user Watchlists
Chooses the best rated answer for questions that are closed for more than 24 hours and the owner has not yet chosen the best answer
Closes Questions from deleted users
If enabled purges Questions that are archived longer than X months
Processes CRON in payment items (if needed for a specific payment item)

Love Factory

Social Factory

Sends notifications about ending memberships (if enabled)

RSS Factory

RSS Factory PRO
Refreshes the feeds
Inserts the content into Joomla Content (for PRO version)


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 hosting provider 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');


If you use lynx or wget, the CRON job will access the script URL as seen in any browser. For instance:


http://[yoursite]/index.php?option=com_jobsfactory&controller=crontask&pass=pass


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


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 for expired items and close them). For Daily jobs you have to append &daily=1 to the URL.


Example:


http://[yoursite]/index.php?option=com_jobsfactory&controller=crontask&pass=pass&daily=1


Below is the list of CRON Jobs using lynx, curl or wget. If your hosting allows 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]/index.php?option=com_auctionfactory&controller=crontask&pass=pass'

wget -O - -q 'http://[yoursite]/index.php?option=com_auctionfactory&controller=crontask&pass=pass'

curl --silent –compressed 'http://[yoursite]/index.php?option=com_auctionfactory&controller=crontask&pass=pass'


Penny Auction Factory


lynx -accept_all_cookies –dump ':http://[yoursite]/index.php?option=com_pennyfactory&controller=crontask&pass=pass'

wget -O - -q ':http://[yoursite]/index.php?option=com_pennyfactory&controller=crontask&pass=pass'

curl --silent –compressed ':http://[yoursite]/index.php?option=com_pennyfactory&controller=crontask&pass=pass'


Reverse Auction Factory


lynx -accept_all_cookies –dump 'http://[yoursite]/index.php?option=com_rbids&controller=crontask&pass=pass'

wget -O - -q 'http://[yoursite]/index.php?option=com_rbids&controller=crontask&pass=pass'

curl --silent –compressed 'http://[yoursite]/index.php?option=com_rbids&controller=crontask&pass=pass'


Dutch Auction Factory


lynx -accept_all_cookies –dump 'http://[yoursite]/index.php?option=com_dutchfactory&controller=crontask&pass=pass'

wget -O - -q 'http://[yoursite]/index.php?option=com_dutchfactory&controller=crontask&pass=pass'

curl --silent –compressed 'http://[yoursite]/index.php?option=com_dutchfactory&controller=crontask&pass=pass'


Raffle Factory


lynx -accept_all_cookies –dump 'http://[yoursite]/index.php?option=com_raffle&controller=crontask&pass=pass'

wget -O - -q 'http://[yoursite]/index.php?option=com_raffle&controller=crontask&pass=pass'

curl --silent –compressed 'http://[yoursite]/index.php?option=com_raffle&controller=crontask&pass=pass'


Jobs Factory


lynx -accept_all_cookies –dump 'http://[yoursite]/index.php?option=com_jobsfactory&controller=crontask&pass=pass'

wget -O - -q 'http://[yoursite]/index.php?option=com_jobsfactory&controller=crontask&pass=pass'

curl --silent –compressed 'http://[yoursite]/index.php?option=com_jobsfactory&controller=crontask&pass=pass'


Ads Factory


lynx -accept_all_cookies –dump 'http://[yoursite]/index.php?option=com_adsfactory&controller=crontask&pass=pass'

wget -O - -q 'http://[yoursite]/index.php?option=com_adsfactory&controller=crontask&pass=pass'

curl --silent –compressed 'http://[yoursite]/index.php?option=com_adsfactory&controller=crontask&pass=pass'


Swap Factory


lynx -accept_all_cookies –dump 'http://[yoursite]/index.php?option=com_swapfactory&controller=crontask&pass=pass'

wget -O - -q 'http://[yoursite]/index.php?option=com_swapfactory&controller=crontask&pass=pass'

curl --silent –compressed 'http://[yoursite]/index.php?option=com_swapfactory&controller=crontask&pass=pass'


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]'


Events Factory

lynx -accept_all_cookies –dump 'http://[yoursite]/components/com_eventsfactory/cron_action.php?pass=[yourpass]'

wget -O - -q 'http://[yoursite]/components/com_eventsfactory/cron_action.php?pass=[yourpass]'

curl --silent –compressed 'http://[yoursite]/components/com_eventsfactory/cron_action.php?pass=[yourpass]'


Social Factory


lynx -accept_all_cookies –dump 'http://[yoursite]/components/com_socialfactory/cron_action.php?pass=[yourpass]'

wget -O - -q 'http://[yoursite]/components/com_socialfactory/cron_action.php?pass=[yourpass]'

curl --silent –compressed 'http://[yoursite]/components/com_socialfactory/cron_action.php?pass=[yourpass]'


RSS Factory


lynx -accept_all_cookies –dump 'http://[yoursite]/components/com_rssfactory/helpers/refresh.php?password='

wget -O - -q 'http://[yoursite]/components/com_rssfactory/helpers/refresh.php?password='

curl --silent –compressed 'http://[yoursite]/components/com_rssfactory/helpers/refresh.php?password='


Note that some hosts may require additional parameters in the CRON job in order for the job to run. For example, a user agent specification is required in certain mod_security implementations. Consult their documentation or contact the host directly for such cases, since they know best regarding this.


Extensions that require daily jobs:


  • Auction Factory
  • Reverse Auction Factory
  • Dutch Auction Factory
  • Raffle Factory
  • Jobs Factory
  • Ads Factory
  • Swap Factory
  • jAnswers Factory
  • Love Factory
  • Events Factory
  • Social Factory


Extensions that require normal jobs (every 5-10 minutes):


  • Auction Factory
  • Reverse Auction Factory
  • Dutch Auction Factory
  • Raffle Factory
  • Jobs Factory
  • Ads Factory
  • Swap Factory
  • jAnswers Factory
  • RSS Factory
  • RSS Factory PRO


For Auction components (Auction Factory, Penny Auction Factory, Reverse Auction Factory, Dutch Auction Factory, Raffle Factory) having a windows webserver, we recommend for you to search for a version of lynx for windows regularly called lynx_w32 and presented as an archive file. Download and unzip it in a desired folder, read the readme.txt file for setting it, then create a BAT file in order to write the following to call CRON through lynx browser:

@echo off\\
SET PATH=%PATH%;[SET THE ABSOLUTE PATH TO]\lynx_w32\\
SET lynx_cfg=[SET THE ABSOLUTE PATH TO]\lynx_w32\lynx.cfg\\
\\
:START\\
\\
@echo Run CRON \\
lynx.exe -source "http://[REPLACE WITH YOUR HOST NAME]/index.php?option=com_extension&controller=crontask&pass=[REPLACE WITH YOUR CRON PASSWORD]&daily=1"\\
\\
\\
:DONOTHING//\\


Replace com_extension with the following, depending on the component:

  • Auction Factory : com_auctionfactory
  • Reverse Auction Factory : com_rbids
  • Dutch Auction Factory : com_dutchfactory
  • Raffle Factory : com_rafflefactory


Now with the BAT file created you must set an windows task scheduler to run your created BAT at specified time.



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 its 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 ).


Ads Factory


php [yoursite]/index.php?option=com_adsfactory&controller=crontask&pass=[yourpass]


Swap Factory


php [yoursite]/index.php?option=com_swapfactory&controller=crontask&pass=[yourpass]


jAnswers Factory


php [yoursite]/components/com_jooanswers/cron_action.php?pass=[yourpass]


Love Factory


php [yoursite]/components/com_lovefactory/cron_action.php?pass=[yourpass]


RSS Factory


php [yoursite]/components/com_rssfactory/helpers/refresh.php?password=[yourpass]


The &daily=1 parameter can also be used.


How to run CRON even if your host does not support it.


There is a cheap and simple way to have a CRON job running when your hosting does not support it. You can use Google Scripts from your Google Drive.


For instance you can create an empty Google Drive document called "My Auction Factory CRON". Then go to "Tools / Script Editor" menu, it will open a new editor window.


In the editor paste this code (Remember to replace the obvious placeholders with your information, and extension name):


function myFunction() {
  var page = UrlFetchApp.fetch('http://[YOUR WEBSITE HERE]?option=com_[YOUR EXTENSION]&controller=crontask&pass=[CRON PASS HERE]').getContentText();
  var body = DocumentApp.getActiveDocument().getBody();
  var text = body.editAsText();
  text.appendText(page)
}


You can get the extension name from any link within that respective extension, it is usually something like "com_auctionfactory" or "com_adsfactory".




Then save the script and run it once. It will ask you for permissions that you have to allow.


Then set up the Schedule by clicking the menu "Resources / All your Triggers"





Notes:


If the CRON does not seem to work, please try to find in your hosting help, or ask support if they support these calls.
A detailed tutorial regarding CRON jobs in general is available here: https://drupal.org/node/23714 - even if written for Drupal, most of it is CRON specific.