Logo

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
cronjob [2017/03/31 11:33]
sorin [Where do i set up my CRON Jobs?]
cronjob [2017/03/31 11:45]
sorin
Line 1: Line 1:
-====== CRON Job Settings ​for thePHPfactory Extensions ​======+====== ​Setting up CRON for Auction Factory ​======
  
-\\ 
- 
-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? ==== ==== 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. 
  
 \\ \\
Line 35: Line 22:
 \\ \\
  
-    * The Factory CRON Documentation ​(this document) ​+    * [[http://​wiki.thephpfactory.com/​doku.php?​id=cronjob|The Factory CRON Documentation]] 
     * [[http://​www.siteground.com/​tutorials/​cpanel/​cron_jobs.htm|CRON jobs in CPANEL Hostings]] ​     * [[http://​www.siteground.com/​tutorials/​cpanel/​cron_jobs.htm|CRON jobs in CPANEL Hostings]] ​
     * [[http://​help.godaddy.com/​article/​3547|CRON Jobs in Godaddy Hostings]] ​     * [[http://​help.godaddy.com/​article/​3547|CRON Jobs in Godaddy Hostings]] ​
     * [[http://​wiki.dreamhost.com/​Cron_Jobs|CRON jobs in Dreamhost panel]] ​     * [[http://​wiki.dreamhost.com/​Cron_Jobs|CRON jobs in Dreamhost panel]] ​
 +
  
 ==== What tasks do i set up in my CRON Jobs? ==== ==== What tasks do i set up in my CRON Jobs? ====
Line 77: Line 65:
  
 \\ \\
- 
-==== 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:// 
- 
-\\ 
- 
-<code php> 
-define('​AUCTIONS_CRON_PASSWORD','​pass'​);​ 
-</​code>​ 
- 
-\\ 
- 
-If you use lynx or wget, the CRON job will access the script URL as seen in any browser. For instance: ​ 
- 
-\\ 
- 
-<​code>​ 
-http://​[yoursite]/​index.php?​option=com_jobsfactory&​controller=crontask&​pass=pass 
-</​code>​ 
- 
-\\ 
- 
-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: 
- 
-\\ 
- 
-<​code>​ 
-http://​[yoursite]/​index.php?​option=com_jobsfactory&​controller=crontask&​pass=pass&​daily=1 
-</​code>​ 
- 
-\\ 
- 
-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** 
- 
-\\ 
- 
-<​code>​ 
-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'​ 
-</​code>​ 
- 
-\\ 
-**Penny Auction Factory** 
- 
-\\ 
- 
-<​code>​ 
-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'​ 
-</​code>​ 
-\\ 
- 
-**Reverse Auction Factory** 
- 
-\\ 
- 
-<​code>​ 
-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'​ 
-</​code>​ 
- 
-\\ 
- 
-**Dutch Auction Factory** 
- 
-\\ 
- 
-<​code>​ 
-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'​ 
-</​code>​ 
- 
-\\ 
- 
-**Raffle Factory** 
- 
-\\ 
-<​code>​ 
-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'​ 
-</​code>​ 
- 
-\\ 
- 
-**Jobs Factory** 
- 
-\\ 
-<​code>​ 
-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'​ 
-</​code>​ 
- 
-\\ 
- 
-**Ads Factory** 
- 
-\\ 
-<​code>​ 
-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'​ 
-</​code>​ 
- 
-\\ 
-**Swap Factory** 
- 
-\\ 
-<​code>​ 
-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'​ 
-</​code>​ 
- 
-\\ 
- 
-**jAnswers Factory** 
- 
-\\ 
-<​code>​ 
-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]'​ 
-</​code>​ 
- 
-\\ 
- 
-**Love Factory** 
- 
-\\ 
-<​code>​ 
-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]'​ 
-</​code>​ 
- 
-\\ 
-**Events Factory** 
-\\ 
-<​code>​ 
-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]'​ 
-</​code>​ 
-\\ 
- 
-**Social Factory** 
- 
-\\ 
-<​code>​ 
-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]'​ 
-</​code>​ 
- 
-\\ 
- 
-**RSS Factory** 
- 
-\\ 
- 
-<​code>​ 
-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='​ 
- 
-</​code>​ 
- 
-\\ 
- 
-**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:\\ 
-\\ 
-<​code>​@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//​\\ 
-</​code>​ 
-\\ 
-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): 
- 
-\\ 
-<code JavaScript>​ 
-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) 
-} 
-</​code>​ 
- 
-\\ 
- 
-You can get the extension name from any link within that respective extension, it is usually something like "​com_auctionfactory"​ or "​com_adsfactory"​. 
- 
-\\ 
- 
-{{gallery>​ joomla30:​cron_save_run.jpg }}\\ 
- 
-\\ 
- 
- 
-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"​ 
- 
-\\ 
- 
-{{gallery>​ joomla30:​cron_in_google_drive.jpg }}\\ 
-\\ 
- 
 ---- ----
-**Notes:**  +**(!)** Documentation based on **Auction Factory** version **4.3.3**
- +
-\\ +
- +
-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.+