crontab/mirc.


== Whats it? ===================================================================
This script is a port of the unix cron daemon and crontab command to mirc. Its
aim is to execute schedulded jobs at a given time. 


== Hows it work? ===============================================================
Extract crontab.mrc and clp.mrc to your mirc directory and load the scripts with
'/load -rs clp.mrc' and '/load -rs crontab.mrc' in this order. Initialize with
/crontab.


== The mechanism ===============================================================
(the following was mostly taken from the crond and crontab manpages.)

The script always synchronizes at the top of the minute, checking the current 
time against a list of possible jobs.

Each line has five time and date fields, followed by a command.  Commands are 
executed by crontab when the minute, hour, and month of year fields match the 
current time, and when at least one of the two day fields (day of month, or day 
of week) match the current time (see Note below). crontab examines cron entries 
once every minute. Blank lines in the crontab or lines that begin with a hash 
(#) are  ignored. The time and date fields are:

	   field	 allowed values
	   -----	 --------------
	   minute	 0-59
	   hour 	 0-23
	   day of month  0-31 (0 is here to let day of week match)
	   month	 1-12 (or names, see below)
	   day of week	 0-7 (0 or 7 is Sun, or use names)

A field may be an asterisk (*), which always stands for first-last.

Ranges of numbers are allowed. Ranges are two numbers separated with a hyphen 
(-). The specified range is inclusive. For example, 8-11 for an hours entry 
specifies execution at hours 8, 9, 10 and 11.

Lists are allowed. A list is a set of numbers (or ranges) separated by commas 
(,). Examples: "1,2,5,9", "0-4,8-12".

Step values can be used in conjunction with ranges. Following a range with / 
specifies skips of the number's value through the range. For example, "0-23/2" 
can be used in the hours field to specify command execution every other hour 
(an alternative to 0,2,4,6,8,10,12,14,16,18,20,22). Steps are also permitted 
after an asterisk, so if you want to say 'every two hours', just use */2.

Names can also be used for the month and day of week fields. Use the first three
letters of the particular day or month (case doesn't matter). Ranges or lists of
names are allowed.

The sixth field (the rest of the line) specifies the command to be run.  The 
entire command portion of the line will be executed.

Note: The day of a command's execution can be specified by two fields -- day of 
month, and day of week.  If both fields are restricted (ie aren't *), the 
command will be run when either field matches the current time. For example, 
"30 4 1,15 * 5" would cause a command to be run at 4:30 am on the 1st and 15th 
of each month, plus every Friday.

Instead of the first five fields, one of eight special strings may appear:

	   string	   meaning
	   ------	   -------
	   @yearly	   Run once a year, "0 0 1 1 *"
	   @annually	   (sames as @yearly)
	   @monthly	   Run once a month, "0 0 1 * *"
	   @weekly	   Run once a week, "0 0 * * 0"
	   @daily	   Run once a day, "0 0 * * *"
	   @midnight	   (same as @daily)
	   @hourly	   Run once an hour, "0 * * * *"

EXAMPLE CRON FILE
# This line is a comment and will be ignored
5 0 * * *	echo "run five minutes after midnight"
15 14 1 * *	echo "run at 2:15pm on the first of every month"
0 22 * * 1-5	echo "run at 10 pm on weekdays"
23 0-23/2 * * *	echo "run 23 minutes after midn, 2am, 4am ..., everyday"
5 4 * * sun	echo "run at 5 after 4 every sunday"
@hourly		echo "run at the top of every hour"


== Files used ==================================================================
clp.mrc		The script that will understand the options passed to /crontab
crontab.mrc	The script file
crontab.txt	This readme file
crontab.sav	The job file


== Options =====================================================================
These options are to be submitted at launch time.
-e		edit the crontab
-l		list the crontab
-h		display the manual (this file)
--die		make crontab stop
--exec		make crontab check jobs now; this is the option passed to
		crontab at the top of every minute
--sync		resync crontab to current time

long options:
--edit		same as -e
--list		same as -l
--help		same as -h
--man		same as -h

== Limitations =================================================================
Unlike the unix crond, crontab.mrc does not send any email since there's no way 
of telling if the command executed successfully.
crontab.mrc does not support multiple users (ie, no diff crontab for each user).


Thats all i can think of right now.
t0m@gawd.net


