home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
182.lha
/
ARexxCron
/
RXCron.doc
< prev
next >
Wrap
Text File
|
1988-04-28
|
6KB
|
139 lines
RXCRON, a "cron" program for the Amiga ARexx environment.
INTRODUCTION
------------
For all you REXXophiles, here's another one: "RXCron".
RXCron is an ARexx clone of "AmiCron", a program that
automatically runs commands at predetermined times.
Briefly stated, once a minute RXCron looks at a "crontab" file to check
whether the current date/time matches any of the entries in the file;
if so, the DOS command specified in the matching entry is issued.
RXCron is intended to be compatible with AmiCron v2.4. You should be
able to use the same (unmodified) crontab file you used with AmiCron.
I wrote RXCron because I use WShell (another fine product from
Bill Hawes), and I wanted my crontab commands to be able to use the shell.
(However, WShell is not required to use RXCron).
I think RXCron has a few advantages over AmiCron. Namely:
- it fits nicely into the ARexx/WShell environment
- saves about 7000 bytes of disk/ram space over AmiCron
- source can be easily customized by the user
- RXCron reads the crontab file only once. Thereafter, it
just checks the file's time stamp, and rereads it only
if the file has been modified since it last looked.
- it types a "log" message whenever it issues a command
This file package should contain:
RXCron.rexx the program
RXCron.doc you're reading it
datebug.txt description of ARexx bug in DATE(), and patch
RXCRON IS IN THE PUBLIC DOMAIN. AS SUCH, IT IS OFFERED "AS-IS".
PREPARATION
-----------
Note: you must use ARexx version 1.06 or better to run RXCron,
because it uses the new Delay, Date, and improved StateF functions.
Note: you must have added the "rexxsupport.library" to the ARexx library
list. I use the RXLIB command to do this in my startup-sequence.
If you edit the RXCron.rexx file, notice the first executable line is:
runprog="run >nil:"
This defines the run program that RXCron will use to launch commands.
I use WShell, so mine is "runwsh >nil:". You may want to change this to
ARP's ARun, or RunBack, etc., or just leave it as RUN.
STARTING THE PROGRAM
--------------------
RXCron should be run in a separate CLI or WShell, because the program
runs continuously, and because a window is needed to print messages
from RXCron and the launched commands. To run the program:
RX RXCron (start program, using S:crontab)
or RX RXCron [file] (start program, using other crontab file)
The RX is not necessary if you are using WShell.
If RXCron is started from startup-sequence, be sure it gets started
*after* the REXX host is up and running (this should go without saying).
Since RXCron runs continuously, you may need to kill it. To do this,
issue from another CLI: "RX RXCron -k". This signals the running
RXCron (ALL of them that may be running) to quit. It won't terminate
until the program wakes up again, which may take up to 1 minute.
CRONTAB FILES
-------------
RXCron requires that the user provide a "crontab" file. This file
contains specifications of the date/time of events and the commands
to issue at those times. Use a favorite text editor to create yours.
The default file name RXCron looks for is "S:crontab", but you may
specify another. Whatever it's called, you will probably want the
file to be located in a RAM disk, to avoid requesters and disk gronking.
The file is organized as one event per line. Each line consists of
5 numbers followed by a command, all separated by spaces or tabs:
n1 n2 n3 n4 n5 command
"n1" is the minute specification: 0 to 59
"n2" is the hour specification: 0 to 23
"n3" is the day specification: 1 to 31
"n4" is the month specification: 1 to 12
"n5" is the day-of-week specification: 0 to 6 for Sunday to Saturday.
"command" is the AmigaDOS or WShell command to be run.
ALSO, each number may be specified as:
An asterisk (*), for "don't care" or "all".
A list, with each number separated by commas. e.g: 0,15,30,45
A range, with two numbers separated by a dash. e.g: 15-31
Careful, RXCron does not check that numbers are within a valid range.
Examples:
* * * * * date (prints date every minute)
0,30 * * * * rx cuckoo (announce time every hour and half hour)
30 4 * * 1-5 uupc (run uupc at 4:30am every day except Sat,Sun)
30 19 * * 1,3,5 backup (backup files every other day at 7:30pm)
0 8 25 12 * playjinglebells (play _Jingle Bells_ at 8am on Christmas)
AREXX BUGS
----------
While writing this program, I came across a few ARexx bugs. Bill Hawes
has informed me that patches for these will be posted soon. For now,
the bugs can be circumvented. Here are the circumventions I used;
do not change these lines unless you have patched the bugs.
- The SETCLIP at line 21 must have an even number of zeroes: "00".
This avoids a GURU when the StateF function is called later.
- The PARSE statement at line 25 uses junk variables "a b c d e" instead
of placeholders (.) . This avoids a bug which slowly eats storage.
- The Match function at line 60 does not use PROCEDURE. Storage eater again.
Allegedly there is a bug in the ARexx version 1.06 DATE() function,
as reported by in a USENET article, part of which I have included here
in the "datebug" file. I am using the patch described in the article
with no apparent ill effects. But, use the patch at your own risk.
REVISION HISTORY
----------------
0.2 first public domain release
0.1 intermediate version, "not entirely successful"
0.0 first draft
---------------
Thanks to the authors of the original AmiCron program:
Steve R. Sampson, Rick Schaeffer, Christian Balzer.
Thanks to Bill Hawes for ARexx and WShell.
Questions, comments, improvements:
Robert Rethemeyer at BBS-JC (415/961-7250).
Good Luck with RXCron.