User Tools

Site Tools


admin_menu:site_setup:cron_jobs:start

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
admin_menu:site_setup:cron_jobs:start [2008/11/11 23:08]
jonyo
admin_menu:site_setup:cron_jobs:start [2014/09/25 16:55] (current)
Line 2: Line 2:
 ====== Cron Jobs ====== ====== Cron Jobs ======
  
-==== How cron tasks work...what a cron task is: ====+Admin Page: **Site Setup > Cron Jobs** 
 + 
 +In the admin panel, it gives the warning: 
 +<html><span style="color: red;"><strong>Warning:</strong> Changing settings on this page can have drastic effects if your server is not configured correctly. It is important that you <strong>consult the user manual</strong>, so that you may fully understand what is happening, before changing any settings on this page.</span></html> 
 + 
 +The **reason for the strong warning** is so you come to this page to learn what is needed to change certain settings on the page, specifically what you need to do before switching to //Option B//.  Don't let the warning scare you too much though, if you are familiar with setting up cron tasks for your hosting (or your hosting has good instructions for doing so), you should be fine with setting up the basic heartbeat to run once a minute, just use the [[#Manually Run Heartbeat every minute]] example listed in your admin panel for doing so.  The main thing, is after you have set it up to use a manual cron task, after about a week or so, be sure to come back to the cron tasks page and look at the //Last Run// time for each of the cron tasks.  If none of them have been run recently you will need to double check to make sure you have it all set up correctly, or just switch it back to doing //Option A//.  It is a good idea to come back to the page periodically just to make sure everything is still running smoothly. 
 + 
 +===== How cron tasks work...what a cron task is: =====
  
 A cron task, with respect to this software, is an individual task that is meant to be run at a specific interval, to do things like closing listings, moving expired listings to the archive table, removing old images, etc. A cron task, with respect to this software, is an individual task that is meant to be run at a specific interval, to do things like closing listings, moving expired listings to the archive table, removing old images, etc.
Line 16: Line 23:
 Cron tasks can either be run using the internal schedule for each task, using the "heartbeat", or can be manually run. Cron tasks can either be run using the internal schedule for each task, using the "heartbeat", or can be manually run.
  
-==== Cron Settings ====+===== Cron Settings =====
  
-=== Run "Heartbeat": ===+==== Run "Heartbeat": ====
  
 a. Automatically when page loads (Default) a. Automatically when page loads (Default)
Line 24: Line 31:
 b. Manually with Cron Job (Requires Manual Server-Side Cron Jobs) b. Manually with Cron Job (Requires Manual Server-Side Cron Jobs)
  
-== Option a ==+=== Option a ===
 Is recommended for most sites, as it requires no additional configuration on the server side.  With this option, every page view on the client side uses javascript to call the heartbeat.  Since it is running separately from the main part of the page view by using javascript to call it, the heartbeat will not slow down the page load time. Is recommended for most sites, as it requires no additional configuration on the server side.  With this option, every page view on the client side uses javascript to call the heartbeat.  Since it is running separately from the main part of the page view by using javascript to call it, the heartbeat will not slow down the page load time.
  
-== Option b ==+=== Option b ===
 Is for advanced users only, as it requires additional configuration on the server side to set up cron jobs.  Using this option turns off the automatic heartbeat on every client side page view, and relies on the heartbeat to be called using a "cron job" set up to run however often you set it to.  If you do decide to set up a cron job to run the heartbeat, we recommend setting it to run in 1-5 minute intervals. Is for advanced users only, as it requires additional configuration on the server side to set up cron jobs.  Using this option turns off the automatic heartbeat on every client side page view, and relies on the heartbeat to be called using a "cron job" set up to run however often you set it to.  If you do decide to set up a cron job to run the heartbeat, we recommend setting it to run in 1-5 minute intervals.
  
 If you wish to run each task manually instead of letting the heartbeat decide which tasks to run, you would also select option b to turn of automatic calls to the heartbeat routine. If you wish to run each task manually instead of letting the heartbeat decide which tasks to run, you would also select option b to turn of automatic calls to the heartbeat routine.
  
-=== Cron Security Key: ===+==== Cron Security Key: ====
  
 This is the key that must be used when calling specific tasks to be run using a cron routine, but it is not required when calling the heartbeat routine.  It is randomly generated the first time the cron back-end is used, but you can change it if you wish, or clear the field to have the key reset to a new random value. This is the key that must be used when calling specific tasks to be run using a cron routine, but it is not required when calling the heartbeat routine.  It is randomly generated the first time the cron back-end is used, but you can change it if you wish, or clear the field to have the key reset to a new random value.
  
-=== Time before lock removed (Deadlock prevention): ===+==== Time before lock removed (Deadlock prevention): ====
  
 When a task is being called it is "locked" by the system to prevent the task from being run multiple times at once.  For example, this process helps to prevent pitfalls such as multiple e-mails being sent. When a task is being called it is "locked" by the system to prevent the task from being run multiple times at once.  For example, this process helps to prevent pitfalls such as multiple e-mails being sent.
Line 42: Line 49:
 The "Time before lock removed" setting, is the amount of time, in seconds, before such a lock is manually removed by the system.  This is done to prevent a situation known as "deadlock", where if a task "dies" because of an error, it stays locked even though the task is technically not running any more.  If you are not sure what this setting is used for, keep the setting at the default of 1800 Seconds (30 minutes). The "Time before lock removed" setting, is the amount of time, in seconds, before such a lock is manually removed by the system.  This is done to prevent a situation known as "deadlock", where if a task "dies" because of an error, it stays locked even though the task is technically not running any more.  If you are not sure what this setting is used for, keep the setting at the default of 1800 Seconds (30 minutes).
  
-==== Cron Task Information ==== +===== Cron Task Information ===== 
- +====Available Tasks/Heartbeat Schedule Info: ====
-===Available Tasks/Heartbeat Schedule Info: ===+
    
-Lists all of the tasks that are currently in the system, and lists information about each task.  There should be 3 main tasks for Basic editions, and 4 main tasks for Premier and Enterprise edition.  Addons may also add their own tasks, you can tell it is an addon because the task name will have a ":" in the task name.  If you were to install and enable the example addon version 1.1 or higher, you would see a new task named "example:example_task".+Lists all of the tasks that are currently in the system, and lists information about each task.  Addons can add their own tasks, you can tell it is an addon because the task name will have a ":" in the task name.  If you were to install and enable the example addon version 1.1 or higher, you would see a new task named "example:example_task".
  
 If you are going to run specific tasks using cron jobs (instead of using the built-in heartbeat task), the task name must match one of the tasks listed in this section in your admin, or that task will not be run. If you are going to run specific tasks using cron jobs (instead of using the built-in heartbeat task), the task name must match one of the tasks listed in this section in your admin, or that task will not be run.
  
-==== Cron Job Examples: ====+===== Cron Job Examples: =====
  
 This section gives examples of cron jobs you may set up, with the site URL and cron key set to match your site. This section gives examples of cron jobs you may set up, with the site URL and cron key set to match your site.
  
-"Manually Run Heartbeat every minute":  This is an example of how you would use a cron job to call the heartbeat task, instead of loading the heartbeat task automatically on each page load.  If your server does not have the command line browser "lynx", you must substitute whatever command line browser your server does have.+==== Manually Run Heartbeat every minute ==== 
 +This is an example of how you would use a cron job to call the heartbeat task, instead of loading the heartbeat task automatically on each page load.  If your server does not have the command line browser "lynx", you must substitute whatever command line browser your server does have.  For example you might substitute "lynx" with "wget" or something similar. 
 + 
 +==== Run the made-up tasks task1 and task2 every Monday at 1AM ==== 
 +This is an example of how to set it up to manually run certain tasks using a cron job, instead of relying on the heartbeat to run the tasks needed.  In the example, it uses **task1** and **task2**, which are **not real task names**, this is just an example.  The [[#Manually Run Heartbeat every minute|first example]] of running the heartbeat would actually work on servers that have lynx, where this example would do nothing since the tasks are not real. 
 + 
 +==== SSH Command Line Options ==== 
 + 
 +Using "command line php" to run cron tasks:  In the first 2 examples, using lynx in the cron job will work as long as lynx is installed on your server, or if your server has another command line browser that can be used instead. 
 + 
 +If your server does not have a command line browser, it is also set up to be called using PHP to run it directly on the command line, however this is not guaranteed to work since server configurations can vary widely.  If you wish to test using PHP instead of lynx, wget, or another method, using SSH try the following command: 
 + 
 +  php /path/to/cron.php --help 
 + 
 +Replace "**/path/to/cron.php**" with the absolute path to the file cron.php on your server, which will be listed in your admin.  This will display information on how to use cron.php to be run on the command line, without using a browser.
  
-"Run the made-up tasks task1 and task2 every Monday at 1AM":  This is an example of how to set it up to manually run certain tasks using a cron job, instead of relying on the heartbeat to run the tasks needed.  In the example, it uses task1 and task2, which are not real task names, this is just an example.  The first example of running the heartbeat would actually work on servers that have lynx, where this example would do nothing since the tasks are not real.+=====Are My Cron Routines Running?=====
  
-"SSH Command Line Options"+To verify if a cron has been run correctly or not, in the admin to go to the following admin tool:
  
-Using "php" to run cron tasks:  In the first 2 examples, using lynx in the cron job will work as long as lynx is installed on your server, or if your server has another command line browser that can be used instead.+  SITE SETUP > CRON JOBS
  
-If your server does not have a command line browser, it is also set up to be called using php to run it directly on the command line, however this is not guaranteed to work since server configurations can vary widely.  If you wish to test using PHP instead of lynx or another browser, using SSH try the following command:+and look at the times for "last runon the cron jobs.  Make sure that all the cron jobs listed have been run recently.  Note that how recently they run will depend on how often each cron job is set to run.
  
-php /path/to/cron.php --help 
  
-Replace "/path/to/cron.php" with the absolute path to the file cron.php on your server.  This will display information on how to use cron.php to be run on the command line, without using a browser. 
admin_menu/site_setup/cron_jobs/start.1226444908.txt.gz · Last modified: 2014/09/25 16:55 (external edit)