Changes

Jump to navigation Jump to search

Coral: cron intro

6,580 bytes added, 13:45, 12 November 2011
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..."
<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-size:12px">'''''Coral'' :'''&nbsp; [[Coral: cron intro|CRON]] | [[Coral: cron configuration detail|CRON - Configuration detail]] | [[Coral: cron portable design|CRON - Portable Design]] | [[Coral: cron srvstart utility|CRON - SrvStart utility tutorial]]</span></div>

{|style="margin-top:5px;"
|-valign="top"
|
<span style="margin-bottom:5px;font-size:25px;color: #31799F;">CRON - Introduction</span>

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.


__TOC__

|
{| cellpadding="0" cellspacing="0" style="margin-left:6px;margin-bottom:5px;padding-left:6px;padding-right:6px;font-size:11px;background-color: #FFFFEB;border: 1px solid darkslateblue;"
|-
|colspan="2" style="font-weight:bold;"| UniServer&nbsp;8-Coral
|-
|&nbsp;||[[Coral: Introduction|Home]]
|-
|&nbsp;||[[Coral: start quick start|Quick Start]]
|-
|&nbsp;||[[Coral: general intro|General]]
|-
|&nbsp;||[[Coral: apache intro|Apache]]
|-
|&nbsp;||[[Coral: mysql intro|MySQL]]
|-
|&nbsp;||[[Coral: php intro|PHP]]
|-
|&nbsp;||[[Coral: msmtp intro|MSMTP]]
|-
|<span style="font-size: 14px;">»</span>||[[Coral: cron intro|CRON]]
|-
|&nbsp;||[[Coral: dtdns intro|DtDNS]]
|-
|&nbsp;||[[Coral: dbbackup intro|Db Backup]]
|-
|&nbsp;||[[Coral: perl intro|Perl]]
|-
|&nbsp;||[[Coral: index main|Main Index]]
|}
|}

==Features==
* 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

==Configuration file==
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:

<span style="padding:6px;background-color:#99FFFF"> '''UniController:''' Server Configuration > Cron > Edit Cron Configuration </span>

{|
|-valin="top"
|
* Each script to be run requires a configuration block. Two examples are shown at right.
* Comand-line scripts (.bat, .php, .vbs) require an absolute path to be specified.
* Web-applications require a URL path. This URL path is what you would type into a browser to run that script.
* Each script running a Command-line or Web-application is defined in a separate block with the following format:
|
<pre>
[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 =
</pre>
|}

===Configuration block format===
{|
|-valign="top"
|[dtdns]||--||Each block starts with a unique name enclosed in square brackets. Note that no spaces are allowed.
|-valign="top"
|start =||--||Initial start time with the following format: Y-M-D H:M:S - Note: 24 hour clock.
|-valign="top"
|period =||--||How often to run the script from the above referenced start time<br />Values: hourly, daily, weekly, monthly or numeric in seconds
|-valign="top"
|path =||--||a) For a web application, the full URL of the script. e.g. http://localhost/drupal/cron.php<br />b) Command-line (CLI) uses an absolute path with back-slashes e.g. C:\UniServer\uni_con\cron\test_cron_1.bat
|-valign="top"
|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.

'''''[[#top | Top]]'''''
==Cron Controller==

Using Cron controller, portable Cron is run either as a standard program or as a service. Open the Cron controller as follows:

<span style="padding:6px;background-color:#99FFFF"> '''UniController:''' Server Configuration > Cron > Cron Controller </span>

{|
|-valign="top"
|
The Cron Controller consists of four buttons (B,C,D and E) as shown on right

* Initially, both program B) and service D) buttons are enabled. When Cron is running, one of these buttons is disabled; for example, if it is running as a service the program button is disabled.


* '''Run as a program:''' To run Cron, click the start button B). With Cron running, this button is disabled and the Stop button C) becomes enabled, allowing you to stop Cron.


* '''Run as a service:''' To install and run Cron, click the start button D). With Cron running as a service, this button is disabled and the Stop and Uninstall Service button E) becomes enabled, allowing you to stop and uninstall Cron service.

|
[[Image:Coral_cron_controller.gif]]
|}

'''''[[#top | Top]]'''''

==Logging==

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.

==Summary==
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.

==Where to next==

[[Coral: cron configuration detail|CRON - Configuration detail]]


'''''[[#top | Top]]'''''

----

[[Category: Uniform Server 8-Coral]]

Navigation menu