A..14 Cron

The Cron Admin Tool is where you manage Scoop's scheduled tasks, those tasks which are not done in response to a user action, such as dealing with RDF feeds or cleaning up the sessions table in the database. The Cron Admin Tool is composed of two parts: a list of cron items, and the actions that can be performed on a cron item. This provides similar but different functionality to the Hooks Admin Tool (A.18), the difference being that cron items are run on a timed basis, while hooks are run based on the activities of users and administrators.

To run Scoop's crons, you must have your system scheduler run the scoop/scripts/run_cron.pl with the URL or URLs of your Scoop site's cron op as an argument. If your Scoop site is on a virtual host, i.e., http://www.mysite.com/ displays Scoop's front page, then the URL you give the script is http://www.mysite.com/cron. If your Scoop site is in a subdirectory, i.e., http://www.mysite.com/ is a normal website and http://www.mysite.com/scoop/ displays Scoop's front page, then the URL you give the script is http://www.mysite.com/scoop/cron. Your system scheduler must trigger Scoop's cron system as frequently as the most frequent cron item, as Scoop cannot run its scheduled items unless it is told to, which it is when the cron op is requested.

The list of cron items is a table with seven columns and one row for each item.

The first column is a checkbox, allowing you to select the feeds you want to have an action apply to. As many crons as you like can be selected.

The second column is the name of the cron. The names are usually self-explanatory, but the default crons are described below.

The third column indicates whether or not the cron is a box. Some cron items have code built into Scoop, and some run a box. (See section 5.)

The fourth column is the name of the function or box the cron runs. If the cron runs a box, the function's code can be found in the Boxes Admin Tool (A.11) as a box of the same name. If the cron is not a box, the function's code is in the scoop/lib directory; you will need to search for the function name, and if you change it you will need to stop and start apache for the changes to take effect.

The fifth column is the interval at which the cron should run. The format is <number><unit>; for example, to run a cron once a day you would enter 1d, and to run it every 5 minutes, you would enter 5m. The possible units are s (second), m (minute), h (hour), d (day), w (week), M (month), Y (year).

The sixth column is the time and date of the last time the cron item was run.

The seventh column indicates whether or not the cron is enabled, or run on schedule.

The last row in the table is made up of text boxes or check boxes for all of the information needed to add a new cron item.

Below the table are the possible actions. One of these must be selected when you click the ``Save crons'' button, or nothing will happen. The action selected will apply to all cron items with checked boxes in the list of cron items, unless it is ``Add Cron'', in which case it will create a new row with the contents of the text boxes in the last row of the table.

Below the actions is a link that will run whatever cron items are due to run, independantly of the trigger your system scheduler provides but using the same mechanism.

The actions are:

Force Run
Runs the selected cron items whether they are due to run or not. This can be useful if a cron item does not seem to be doing its job; you can see any error messages it produces that may help you sort out the problem.
Toggle Enabled
Turns the selected cron items on or off. Some cron items are not relevant to some sites, and should be turned off.
Change Run Every
Changes the run interval of the selected cron items to whatever is in the text box in the fifth column. See above for the interval format.
Clear Last Run
Clears the date and time of the last run for the selected cron items. If the cron item is enabled, the next time Scoop's cron system is triggered, that item will be guaranteed to run.
Add Cron
Creates a new cron item using the information entered in the text boxes of the last row of the table.
Remove Cron
Deletes the selected cron items from the table.


janra
2004-03-26