Difference between revisions of "Coral: cron intro"
(Created page with "<div id="top" style="margin:0;padding: 0px 0px 0px 5px; color: #000; background-color: #FFFFEB; border: 1px solid darkslateblue;"><span id="top" style="margin:0;padding: 0px;font...")
Latest revision as of 13:45, 12 November 2011
CRON - Introduction
Cron originated in the Unix environment. It is a job scheduler, allowing scripts to be run automatically at a certain time or date. The name was based on the Greek word for time, "chronos" .
The Uniform Server’s portable Cron plugin has been integrated into 8.0-Coral. Cron's configuration file has been pre-populated with various scripts to be run. These are essentially four-line templates that require enabling to run the appropriate applications from the Cron script.
The Uniform Server provides a simple user control interface to start and stop Cron as a standard program. Alternatively, you can install Cron as a service.
- Configuration file pre-configured for common applications.
- Run Cron as a standard program
- Run Cron as a service
- Run scripts with the following file extensions: .bat, .vbs and .php
- Pre-configured to run DtDNS, DBbackup and Drupal cron jobs
Each script to be run requires a configuration entry in the configuration file cron.ini. Open this file in the default editor using UniController as follows:
UniController: Server Configuration > Cron > Edit Cron Configuration
[db_backup] start = 2009-09-21 2:56:52 period = hourly path = C:\UniServer\uni_con\db_backup\Run_db_backup.bat ref = [moodle] start = 2009-09-21 2:56:52 period = hourly path = http://localhost/moodle/admin/cron.php ref =
Configuration block format
|[dtdns]||--||Each block starts with a unique name enclosed in square brackets. Note that no spaces are allowed.|
|start =||--||Initial start time with the following format: Y-M-D H:M:S - Note: 24 hour clock.|
|period =||--||How often to run the script from the above referenced start time|
Values: hourly, daily, weekly, monthly or numeric in seconds
|path =||--||a) For a web application, the full URL of the script. e.g. http://localhost/drupal/cron.php|
b) Command-line (CLI) uses an absolute path with back-slashes e.g. C:\UniServer\uni_con\cron\test_cron_1.bat
|ref =||--||A timestamp updated by cron script. Set initial value to blank|
Note 1: Cron automatically updates ref. It initially adds period as set above to Start time. For subsequent runs, it sets ref to current time + period.
Note 2: To change start time, first set a new value for start and delete the ref number, then save the file. The script will run at the new date and time set and thereafter at the rate you defined for period.
Note 3: To use pre-configured CLI blocks for dtdns and db_backup, uncomment to enable.
Note 4: To use pre-configured web blocks for drupal and moodle, uncomment to enable.
Note 5: Command-line paths to scripts contained in sub-folders below UniServer are automatically updated (portable). Paths outside UniServer require a manual change.
Using Cron controller, portable Cron is run either as a standard program or as a service. Open the Cron controller as follows:
UniController: Server Configuration > Cron > Cron Controller
The Cron Controller consists of four buttons (B,C,D and E) as shown on right
Cron logs the following information:
- Time Cron was started
- Start time and path of a script that is run.
- Time Cron was stopped. Note: if this is missing from the log, it means the servers were not shutdown before the PC was turned off
Note: Cron logging is enabled by default. This can be disabled; see xxx for details.
The above has shown how easy Cron is to use and configure.
Note: If you enable either or both builtin CLI scripts (DtDNS updater, db_backup), remember to properly set their configuration files.