home *** CD-ROM | disk | FTP | other *** search
- #1zz
-
-
-
-
-
- December 5, 1989 NazCron V1.02 - Cron-type Event Manager Page 1
-
-
- Overview
- --------
-
- NazCron automatically executes CLI commands and programs that can
- be started from a CLI at those times you specify in an event list.
- This event list is a memory resident list that NazCron loads from
- the ASCII text file named CRONTAB located in the S: directory
- and/or from ARexx scripts. Any additions, deletions or changes you
- make to the events in the CRONTAB file will be automatically
- incorporated in NazCron's memory list.
-
- NazCron accepts the Unix Cron file format (see below for details)
- with minor improvements, establishes itself as an ARexx host
- process which can be used as a generalized time server and operates
- in the background by disconnecting itself from its initiating CLI.
-
- A number of internal functions may be controlled through the ARexx
- interface asynchronously to event timing, i.e. all such functions
- are executed as soon as the initiating ARexx command message is
- retrieved from the public message port.
-
- Please note that NazCron does NOT require ARexx to run. The ARexx
- functions serve as an extension to NazCron's CRON functions, which
- are complete in themselves.
-
-
- Written by
- ----------
-
- Don Nafis of NAZLO Associates Ltd.
-
- NazCron may be copied and freely distributed for personal use.
-
- NazCron is shareware, user-supported software. If you like
- NazCron and continue to use it after a trial period, please send
- the $10 shareware fee to the address listed on the following page
- and become a registered user. When you register, I will send you
- the latest registered version of NazCron.
-
- In addition, as a registered user, you will be assured of timely
- information on upgrades, you will be given membership in the
- support section of our BBS, Viva! Amiga!, and you will feel good
- about contributing to the development of new utility programs for
- the Amiga.
-
- By supporting all shareware authors, you will be in the driver's
- seat when it comes to deciding where future Amiga programs will be
- going; you will have a loud voice when we programmers are trying to
- hear what Amiga owners want in programs of the future.
-
- Copyright 1989 by Don Nafis & NAZLO Associates Limited. All rights reserved.z
-
-
-
-
- December 5, 1989 NazCron V1.02 - Cron-type Event Manager Page 2
-
-
- To register as a NazCron user, send your check for $10.00 to
-
- Don Nafis
- Nazlo Associates Ltd.
- P.O. Box 1515
- Laurel Springs, NJ 08021
-
- Please make your check payable to "Nazlo Associates Ltd.".
-
-
- Commercial vendors may distribute NazCron with their products only
- if they distribute all files provided here and make it clear that
- NazCron is shareware. Before distributing NazCron with your
- package, you must obtain written permission from Nazlo Associates
- Ltd. This way we can make sure that you will be distributing the
- latest version.
-
-
- If you find this program lacking in any way and thus choose not to
- register, I would like to hear your suggestions or complaints.
-
-
- Please contact me at one of the following and give me a piece of
- your mind:
-
-
- Nazlo Associates Ltd.
- P.O. Box 1515
- Laurel Springs, NJ 08021
-
- (609) 228-8088 Voice
-
-
- (609) 227-8278 BBS -
- Viva! Amiga!
- 3/12/24 - 8/N/1 - 24 hours
- 130 Megabytes Online
-
-
- Compuserve 70656, 133
-
-
-
-
-
-
-
-
-
-
- Copyright 1989 by Don Nafis & NAZLO Associates Limited. All rights reserved.z
-
-
-
-
- December 5, 1989 NazCron V1.02 - Cron-type Event Manager Page 3
-
-
- Usage
- -----
-
- From the CLI, type:
-
- NazCron<cr>
-
- NazCron detaches itself from the initiating CLI when it begins
- execution. Thus you can terminate the CLI (endcli) and let
- NazCron go on working in the background.
-
- From the Workbench:
-
- Place the pointer on the NazCron Icon and double click with
- the left mouse button.
-
- Un-registered users:
-
- If you are using the un-registered version of NazCron, you will
- see a shareware reminder message in a small window. This is to
- remind you that NazCron is shareware, that the shareware fee is
- $10 and where to send your check. After the reminder has
- displayed for 5 seconds, you must click the left mouse button
- in the window to continue. NazCron will delay all further
- processing until you click in the window. A similar reminder
- window will display every time you modify the CRONTAB file or
- tell NazCron to use a new file and it will display every hour
- after loading an event file. This periodic reminder will
- disappear by itself after a 5 second pause. It does NOT
- require intervention on your part. Note - this hourly reminder
- will display after NazCron launches any events that time out
- during the same minute, thus it will not affect your event
- timing.
-
- Registered users:
-
- Registered users will not see the reminder window. Also, the
- registered version is smaller.
-
-
- NazCron starts by loading the event list from the file CRONTAB
- located in the S: directory. (See below for the CRONTAB file
- format.) If CRONTAB is not present, NazCron simply waits for
- further instruction through its ARexx port. Since NazCron doesn't
- require ARexx to run, it makes no attempt to determine if ARexx is
- installed on the system. Therefore you need not start REXXMAST
- before you start NazCron. If you have neither a CRONTAB file in
- the S: directory nor ARexx, you will simply waste memory by
- starting the program because you will be handling no events and you
-
- Copyright 1989 by Don Nafis & NAZLO Associates Limited. All rights reserved.z
-
-
-
-
- December 5, 1989 NazCron V1.02 - Cron-type Event Manager Page 4
-
-
- have no way of terminating NazCron.
-
- If you attempt to execute NazCron when NazCron is already running,
- it will display a small status window showing you the name of the
- current crontab file, whether event processing is ACTIVE or
- SUSPENDED and whether the crontab file is LOCKED or UNLOCKED. If
- there is no CRONTAB file active, the string
-
- <<no-CRONTAB-active>>
-
- will be displayed. See the ARexx section below for a complete
- discussion of the meaning of these terms. You may show the status
- of the executing NazCron from the CLI or from WorkBench.
-
- Note: the status window will stay on the WorkBench screen until
- you click the left mouse button anywhere within the window or
- press any key on the keyboard, assuming that you didn't
- activate some other window after the status window was
- displayed.
-
- In order to detach itself completely from the initiating CLI,
- NazCron must open a zero length file named "ram:*". This is a
- kludge to get around a quirk in "nil:" file handling in the
- Execute() function of AmigaDos (no relation to the AmigaDOS Execute
- command in the C: directory). This file will do no harm and, after
- terminating NazCron, you may delete it with no ill effects.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Copyright 1989 by Don Nafis & NAZLO Associates Limited. All rights reserved.z
-
-
-
-
- December 5, 1989 NazCron V1.02 - Cron-type Event Manager Page 5
-
-
- CRONTAB event format
- --------------------
-
- The CRONTAB file is an ASCII text file which you must create with
- a text editor and place in the S: directory. Each entry in the
- CRONTAB file is either a comment or an event. Each entry must
- begin in column 1 with the individual parameters separated by
- "white space", i.e. one or more spaces or tabs.
-
- The entry format is:
-
- ; comment
- - or -
- [eventname] min hour day month weekday eventcommand
-
- Where:
-
- [eventname] - an optional name you can supply which identifies
- the event for ARexx processing. If you don't supply a name,
- the event will be invisible to ARexx scripts. "eventname" must
- begin with an alpha character. You can specify as many events
- as you wish with the same eventname, but ARexx commands that
- use "eventname" will only affect the first event encountered,
- so it doesn't make any sense to do so. Since "eventname" is
- not used for actual event processing, each identically named
- event will be processed. Note, "eventname" is not case
- sensitive, NazCron converts all event names to uppercase before
- adding them to the event list. Thus "ImportantEvent" and
- "IMPORTANTEVENT" are the same eventnames for NazCron purposes.
-
- The remainder of the fields are required.
-
- min - the minute at which "eventcommand" will be executed.
- Code the actual minute, minutes, range of minutes or "*" to
- indicate every minute. The numeric values may be provided as:
- a single minute, e.g. 5
- a group of minutes, e.g. 0,10,20,30
- a range of minutes, e.g. 30-45
- or a combination, e.g. 0,10,30,47-50,59
-
- hour, day, month and weekday - use the same format as "min".
-
- Ranges of time values are:
- min: 0-59
- hour: 0-23 (0 = midnight)
- day: 1-31 (day is not checked for
- month. This means that day 31,
- month 2 will be allowed but, of
- course, never executed)
-
- Copyright 1989 by Don Nafis & NAZLO Associates Limited. All rights reserved.z
-
-
-
-
- December 5, 1989 NazCron V1.02 - Cron-type Event Manager Page 6
-
-
- month: 1-12
- weekday: 0-6 (0=Sunday, 6=Saturday)
-
-
- eventcommand - is the AmigaDOS CLI command to be executed. It
- must contain all parameters as if typed from a CLI. Note that
- there will be no CLI window for this command's output. If you
- wish to see the output, you must use redirection when you type
- the command.
-
- Examples of redirection:
-
- Date >ram:date
- Date >"newcon:0/10/640/50/Here is the date"
- Date >prt:
-
- Redirection is indicated by the ">" character. Output that
- would normally be sent to the CLI window for these commands
- would, instead, be sent to the file ram:date, to a new window
- and to the printer.
-
-
- Cron event examples
- -------------------
-
- * * * * * Date
- Executes the ADOS Date command every minute. Since re-
- direction was not specified in the command, you will see no
- evidence that Date was actually executed.
-
- DateToRam * * * * * Date >ram:date
- Also executes the ADOS Date command every minute but the date
- is written to the file "date" on the ram: disk. Note,
- "DateToRam" is the event name for this event, allowing it to
- be manipulated from an ARexx script.
-
- 0 19 * * * NewShell "newcon:0/30/640/30/BIX Time" from s:Bixtime
- At 7pm every day, a shell will be opened, initially executing
- the startup script "Bixtime" from the S: directory. This
- script is probably a reminder that it is now ok to logon to BIX
- for non-prime time access. The script "Bixtime" might look
- something like:
- echo "It is 7pm. It is now ok to logon to BIX"
- wait 10
- endcli
-
- 0 10 * * 6 Access!
- Every Saturday at 10am, NazCron will initiate the terminal
- program Access!
-
- Copyright 1989 by Don Nafis & NAZLO Associates Limited. All rights reserved.z
-
-
-
-
- December 5, 1989 NazCron V1.02 - Cron-type Event Manager Page 7
-
-
-
- 0 0,12,17 * * 1-5 Execute ChangingOfTheGuard
- The script "ChangingOfTheGuard" will be executed at midnight,
- noon and 5pm every Monday through Friday.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Copyright 1989 by Don Nafis & NAZLO Associates Limited. All rights reserved.z
-
-
-
-
- December 5, 1989 NazCron V1.02 - Cron-type Event Manager Page 8
-
-
- ARexx command processing
- ------------------------
-
- NazCron supports a rich body of commands that may be introduced
- from ARexx scripts or other ARexx interfaced programs. In order
- to send these commands to NazCron, the ARexx script must execute
- the ARexx "address NAZCRON" statement prior to sending any NazCron
- commands. "NAZCRON" (note that this MUST be uppercase) is the
- NazCron ARexx host address and must be the current host when any
- NazCron command is invoked. Consult the ARexx manual for further
- information on communicating with ARexx host processes.
-
- The return code settings for all commands will be the standard
- ARexx values as defined in the ARexx supplied header file
- "errors.h". These values are:
-
- RC_OK = 0
- RC_WARN = 5
- RC_ERROR = 10
- RC_FATAL = 20
-
- NazCron returns RC_OK when execution has completed successfully
- and RC_WARN when a secondary result should have been returned from
- the command but the script did not execute the 'options results'
- statement. RC_ERROR is returned for most errors including
- unrecognized command and errors in command syntax. RC_FATAL is
- returned when NazCron is unable to allocate enough memory to return
- the secondary result, or if a command is received after shutdown is
- under way.
-
-
- Individual NazCron ARexx commands
- ---------------------------------
-
- SHUTDOWN
- Terminates NazCron immediately. All outstanding events are
- purged and the timer is stopped. No events will be executed
- after SHUTDOWN is received, even if a timeout was about to
- occur.
-
- SUSPEND
- All event processing will be stopped until a RESUME is sent.
- NazCron will stop looking at events in the event list and will
- ignore the CRONTAB file, even if the file has been modified.
- All ARexx commands may be executed and events in the event list
- may still be manipulated with ARexx commands.
-
- RESUME
- Resumes all event processing.
-
- Copyright 1989 by Don Nafis & NAZLO Associates Limited. All rights reserved.z
-
-
-
-
- December 5, 1989 NazCron V1.02 - Cron-type Event Manager Page 9
-
-
-
- LOCK_EVENTS
- This locks file events in the event list. Normally, the
- CRONTAB file info block is examined each minute to determine
- if the contents of the file have changed. If the file
- timestamp is different from the timestamp recorded the last
- time the file was loaded, all events loaded from the file are
- purged from the event list and the file is reloaded into the
- event list.
-
- CRONTAB file date checking is NOT done when events are locked.
- If you are processing a CRONTAB file that never changes, you
- can LOCK_EVENTS, thereby eliminating the unnecessary overhead
- of examining the CRONTAB file each minute. Since NazCron will
- no longer look at the CRONTAB file, you may also, after
- executing LOCK_EVENTS, remove the disk containing the file.
- This command helps make NazCron useful in a floppy based
- system. Events may still be added or deleted from the event
- list via ARexx commands; only the CRONTAB events are locked.
-
- UNLOCK_EVENTS
- This unlocks the file events in the event list. After this
- command is executed, the CRONTAB file will be examined again
- each minute.
-
- NEW_EVENT_FILE filename
- "filename" must be the full path/file name of a new CRONTAB
- file. NazCron begins processing from the new file
- immediately. If events are "locked" (see LOCK_EVENTS above)
- "filename" will be the file to be used once events have been
- unlocked again. Note that it is not necessary to issue
- CLOSE_EVENT_FILE prior to opening a new file. Caution: while
- NazCron assures that the file exists before doing the switch,
- it does not verify the contents of the file. Consequently, the
- command may return with a successful execution masking an error
- in the contents of the file. If there is a syntax error in the
- new file, all file events will be purged. You will know that
- there is no file event processing either by the fact that
- events you expected to be launched weren't or by getting
- NazCron status. Make sure you test new files before relying on
- them.
-
- CLOSE_EVENT_FILE
- Purges all events previously loaded from the event file and
- stops examining the file. Only ARexx introduced events will
- be processed until the NEW_EVENT_FILE command is executed.
-
- ADD_EVENT cronevent
- Adds "cronevent" to the event list. "cronevent" must be in
-
- Copyright 1989 by Don Nafis & NAZLO Associates Limited. All rights reserved.z
-
-
-
-
- December 5, 1989 NazCron V1.02 - Cron-type Event Manager Page 10
-
-
- the same format as defined above. Note that if "eventname" is
- not supplied, the event will be invisible to most ARexx
- commands.
-
- DELETE_REXX_EVENT eventname
- Deletes the event with "eventname" from the event list only if
- the event was added from an ARexx script. This command may not
- be used to delete a CRONTAB event. If the event doesn't exist,
- RC_ERROR is set. If there are more than one ARexx event in the
- event list with the same "eventname", only the first one in the
- list will be deleted.
-
- DELETE_EVENT eventname
- Deletes any event with "eventname" from the event list. If
- the event doesn't exist, RC_ERROR is set. If there are more
- than one event in the event list with the same "eventname",
- only the first one in the list will be deleted.
-
- PURGE_REXX_EVENTS
- Deletes all ARexx introduced events from the event list, even
- those that are invisible. Events loaded from CRONTAB will
- remain in the list untouched.
-
- SHOW_EVENT eventname
- Returns the actual ASCII cronevent string in the 'result'
- variable for the event named "eventname". If the event
- doesn't exist, RC_ERROR is set. Both ARexx and CRONTAB
- introduced events may be retrieved. If there are more than
- one event in the event list with the same "eventname", only
- the first one in the list will be returned.
-
- LIST_EVENTS
- Returns the eventnames of all named events in the event list
- as a string of names separated by blanks. If there are more
- than one event in the event list with the same "eventname",
- all will be returned. Note, this command makes no
- differentiation between events introduced by ARexx commands
- and CRONTAB loaded events.
-
- SHOW_STATUS
- Returns the status of NazCron. The format of the returned
- message is:
- eventstate filestate cronfilename
- where "eventstate" is either "ACTIVE" or "SUSPENDED",
- "filestate" is either "LOCKED" or "UNLOCKED", and
- "cronfilename" is the full path name of the current event
- file. If there is no CRONTAB file active, the string:
- <<no-CRONTAB-active>>
- will be returned.
-
- Copyright 1989 by Don Nafis & NAZLO Associates Limited. All rights reserved.z
-
-
-
-
- December 5, 1989 NazCron V1.02 - Cron-type Event Manager Page 11
-
-
-
-
- NazCron ARexx script example
- ----------------------------
-
- /* NazCron ARexx script example*/
-
- /* Make sure we send all of our commands to NazCron */
- address 'NAZCRON'
-
- /* Don't bother looking at the file again, it will not change */
- 'LOCK_EVENTS'
-
- 'ADD_EVENT sidevent 48 15 * * * dh1:sid'
- if (rc ~= 0) then say "ADD_EVENT error "|| rc
-
- 'ADD_EVENT myevent * * * * * date >ram:rexxcron.date'
- if (rc ~= 0) then say "ADD_EVENT error "|| rc
-
- 'ADD_EVENT anotherevent * * * * * date >ram:anotherrexxcron.date'
- if (rc ~= 0) then say "ADD_EVENT error "|| rc
-
- /* Get a list of all named events */
- options results
- 'LIST_EVENTS'
- if (rc ~= 0) then say "LIST_EVENTS error " || rc
- else
- do
- eventlist = result
-
- /* display the names */
- say eventlist
- numwords = words(eventlist)
-
- /* If the list isn't empty, display the event connected with
- each name */
- if numwords > 0 then do
- do j=1 to numwords
- event = word(eventlist,j)
- 'SHOW_EVENT '|| event
- if (rc = 0) then say 'Event: ' || event || ', ' || result
- else say 'Event: ' || event || ' not found.'
- end
- end
- end
-
-
-
-
-
- Copyright 1989 by Don Nafis & NAZLO Associates Limited. All rights reserved.z
-
-
-
-
- December 5, 1989 NazCron V1.02 - Cron-type Event Manager Page 12
-
-
- Technical notes and suggestions
- -------------------------------
-
-
- 1. Command stack.
-
- Each command launched by NazCron inherits NazCron's stack.
- The stack size has been hard coded by the custom NazCron
- startup routine to 4k. If the command you are executing
- requires more than the standard 4k stack, you must build an
- ARexx or ADOS Execute script to reset the stack size prior to
- executing the command. Have NazCron launch the script rather
- than the program itself.
-
- Although this might appear an arbitrary design choice, my
- reasoning was that for the vast majority of time NazCron is
- resident and using resources, it is doing nothing but waiting
- and should be using as few resources as possible. Since there
- is an easy way through ARexx and standard ADOS to grab more
- resources for launched programs that require them, it would
- make more sense to tailor the stack allocation to the job to be
- done through scripts rather than try to determine the maximum
- stack size needed to cover all cases and have NazCron use that
- value. Note also that NazCron will not inherit the stack size
- of the CLI or shell that launches it.
-
-
- 2. Debugging.
-
- Should NazCron launch a command that executes with an error,
- since ADOS has no console for error output, the user will be
- given no information on what happened. This is another good
- reason to use scripts to launch programs. A script can be
- debugged independently of NazCron before being introduced into
- a CRONTAB file or through ARexx.
-
- If you are still not convinced of the value of using scripts,
- you can use output redirection from the command to try to
- capture the results. To repeat an example presented above:
- Date >ram:date
- or
- Date >"newcon:0/10/640/50/Here is the date"
- would show the output of date, although the second example
- would go by too fast to be of any use.
-
- You could combine the two methods to record your script output
- as in:
- rx >ram:backup.list backup
- or
-
- Copyright 1989 by Don Nafis & NAZLO Associates Limited. All rights reserved.z
-
-
-
-
- December 5, 1989 NazCron V1.02 - Cron-type Event Manager Page 13
-
-
- execute >"newcon:0/10/640/190/Trace" backup TRACEON
-
- To make the second example more useful, you should probably
- place a Delay() in the script prior to script termination so
- that you have a chance to complete your analysis before the
- window disappears.
-
- A future version of NazCron may have a debugging option if
- there is sufficient interest.
-
-
- 3. Launching scripts.
-
- Since NazCron launches all commands as though they were
- executed from a CLI (using the Ados Execute() function), it can
- not make use of any alias assignments you may have made in a
- shell which launched NazCron. Also, if you are using William
- Hawes' WShell which executes ARexx scripts without requiring
- you to type "rx" first or are executing scripts with the "S"
- flags set that you normally enter as commands in the ADOS
- shell, you will not be able to get NazCron to launch these
- scripts the same way.
-
- For ARexx scripts, you must use the "rx" command in your
- command line, have the "rx" command present in your "C:"
- directory and specify a script that is in your "rexx:"
- directory unless you explicitly provide command and script
- paths in the command line.
-
- The same holds true for ADOS Execute scripts. You must
- explicitly use the Execute command to launch ADOS scripts.
-
-
- 4. Floppy based operations.
-
- Since NazCron uses only 15-20k, depending on the number of
- events you supply in your CRONTAB, it can be quite useful even
- in a 512k Amiga. But to operate in a small system without a
- hard disk could result in a lot of disk juggling on your part.
- NazCron has two features that can help you cut down on some of
- that.
-
- Normally, NazCron wakes up every minute and Examines the file
- info structure for the CRONTAB file. To do so requires that
- the CRONTAB file be available. Thus, if you have removed a
- floppy that contained the file, you will be told, by an Amiga
- DOS requester, to insert it.
-
- If you don't expect to change your CRONTAB file entries and you
-
- Copyright 1989 by Don Nafis & NAZLO Associates Limited. All rights reserved.z
-
-
-
-
- December 5, 1989 NazCron V1.02 - Cron-type Event Manager Page 14
-
-
- are using ARexx, you may eliminate this inconvenience by using
- the ARexx LOCK_EVENTS command. After receiving the lock
- request, NazCron will cease attempting to access the CRONTAB
- file until you UNLOCK_EVENTS. You may then remove the disk
- that contained the CRONTAB file since all of the events will be
- in memory.
-
- You must remember, though, to have the disks with the actual
- event commands and programs mounted at the time NazCron tries
- to launch them.
-
- If you have extra memory, you might want to move your CRONTAB
- and the commands you want executed to Ram:. Make sure that
- your the command strings in the events specify ram: as below:
-
- ram:Access!
-
- You must also tell NazCron that you do not want to use the
- S:CRONTAB file. Do this by sending the ARexx command
- NEW_EVENT_FILE. NazCron will switch to the new file upon
- receiving it.
-
- The NC.rexx script is an easy way to send commands to NazCron.
- You would execute the following from a CLI or shell:
-
- rx nc NEW_EVENT_FILE ram:neweventfile
-
- or to lock the original CRONTAB:
-
- rx nc LOCK_EVENTS
-
-
- 5. ARexx time server.
-
- NazCron may be used as an ARexx time server and told to ignore
- any CRONTAB file events. To do so, send NazCron the
- CLOSE_EVENT_FILE ARexx command. NazCron's events may now only
- come from ARexx. You may then use ARexx to add events, delete
- individual events, purge all events or shutdown NazCron. You
- may obtain the names of all active events and retrieve the
- entire event strings themselves.
-
- The only thing you can not do with this version is to pass
- ARexx commands, through NazCron, to other ARexx processes. You
- can, though, direct NazCron to start other ARexx scripts which
- do so.
-
-
-
-
- Copyright 1989 by Don Nafis & NAZLO Associates Limited. All rights reserved.z
-
-
-
-
- December 5, 1989 NazCron V1.02 - Cron-type Event Manager Page 15
-
-
- Historical notes
- ----------------
-
- A number of months ago, I stumbled on and installed a copy of
- AmiCron to help with unattended maintenance on our BBS, Viva!
- Amiga! While AmiCron was serviceable, and did pretty much what we
- wanted, there was the problem of it requiring a CLI window. With
- the AmiCron window up 24 hours a day amidst lots of activity, it
- was very easy to type a character into the window by mistake, thus
- freezing AmiCron; it would simply stop working until I noticed the
- stray characters and backspaced them out. This problem, and my
- fumble fingers, led to too many missed events. Since Rick
- Schaeffer and Christian Balzar, AmiCron authors, were kind enough
- to include source with the package, I decided to remove the CLI
- requirement by using the Lattice 5.0 startup routine CBack.o. On
- perusing the source, I discovered other things about AmiCron that,
- I felt, could be improved.
-
- AmiCron woke up every minute, opened the CRONTAB file, read all of
- the records to execute any commands that were due, closed the file
- and went back to sleep. The process of sleeping for a minute also
- required some unnecessary I/O. It would create a message port,
- allocate an EXTIO block, open the timer device, go to sleep, wake
- up, close the timer device, free the EXTIO block and delete the
- message port. It went through all of these steps every minute.
- With the thought to make improvements to some of this code, I began
- to modify the source. I hadn't edited too many lines before I
- realized that I really had to redesign the thing to do what I
- wanted.
-
- The timer routines have been simplified, eliminating the DoIO
- which waited for the timer to complete. Instead NazCron does a
- SendIO and the wait for timer completion occurs in a central loop
- in "main". In fact, I lifted this code from a commercial program
- we are developing. With this done, I was able to fold in Arexx
- command handling so that the resulting program is an ARexx host.
- The timer request is allocated once when the program starts so
- that each minute the timer functions simply compute the next
- timeout period and issue another SendIO.
-
- A bigger change involves the actual handling of the events
- themselves. NazCron reads the CRONTAB file on startup, loads the
- events into Exec Node structures and chains them in a List. Each
- time NazCron wakes up, it locks the current CRONTAB file, examines
- the FileInfoBlock structure to determine, via timestamp, if the
- file has changed since it was last loaded. If it has, all events
- previously loaded from the CRONTAB file are deleted from the list
- and the file is reread and loaded back into memory with any changes
- that were made to the file. If the timestamp was not changed, no
-
- Copyright 1989 by Don Nafis & NAZLO Associates Limited. All rights reserved.z
-
-
-
-
- December 5, 1989 NazCron V1.02 - Cron-type Event Manager Page 16
-
-
- more file accesses are necessary. The list is then scanned for
- events to be executed.
-
- Of course, ARexx handling was not present at all in the original
- program. NazCron was my first attempt to make useful ARexx
- functions available in a program. My initial design included a
- small number of commands, but as I began programming, I couldn't
- help but add virtually everything I could think of. It was easy
- to do.
-
- Surprisingly, with all of the new code for event list handling,
- ARexx commands and new file I/O, the resulting program size is
- about 1500 bytes SMALLER than the AmiCron program it replaces.
- Most of the decrease is probably attributable to the fact that I
- Amiga-tized it, the rest to the superb Lattice 5.0 optimization
- algorithms. NazCron has no remaining traces of portability, so
- don't expect to see it on your local GS or COCO real soon now.
-
-
- And then there was version 1.02
- -------------------------------
-
- A bug prompted me to start the next version. I found a bug in the
- timer completion routines that, under the right circumstances (the
- right circumstances don't always come up during testing) would
- occasion a visit from the GURU. With this bug fixed and after 4
- months of NazCron being on its own in the real world with ZERO
- shareware registrations, I prepared this version.
-
- NazCron now has one of those annoying shareware reminders to bug
- the real users to send the money. I have to admit that I had fun
- imagining all kinds of mean and nasty things I could do to those
- who would use the program but not register. BUT, I actually began
- coding in a peaceful and benevolent mood and the reminder is the
- result. The un-registered user is forced to click on the reminder
- window when it first comes up, so I can be sure that he, at least,
- knows that it is there. Thomas Holaday suggested that I include a
- periodic reminder and make it a non-maskable event that is
- executed every hour. This is sort of what I did. I made the
- periodic reminder go away with no intervention required, unlike the
- startup reminder. If I hadn't, I probably would have gotten
- bundles of hate mail as user's 3am events just died. Still in a
- benevolent mood, I made sure that the events that should have been
- launched during the reminder minute were launched before I
- displayed the window.
-
- Not wanting all of this new Intuition code go to waste for
- registered users, I added a status display. This displays
- information that was only available through ARexx in version 1.00.
-
- Copyright 1989 by Don Nafis & NAZLO Associates Limited. All rights reserved.z
-
-
-
-
- December 5, 1989 NazCron V1.02 - Cron-type Event Manager Page 17
-
-
- Just start NazCron a second time and you'll see the new status
- display. It contains the same information you would get from the
- ARexx SHOW_STATUS command.
-
- This version also gives me a good opportunity to add the REMIND
- ARexx script that never made it into the original version and to
- discuss some of the technical problems that seemed to plague a few
- of the 1.0 users.
-
-
-
-
- Thanks to:
- ----------
-
- Lattice for the great 5.04 package - especially CPR,
- Bill Hawes for ARexx,
- Eric Lavitsky for his well structured and information-packed
- Amiga programming course,
- Rick Schaeffer and Christian Balzar for the original AmiCron,
- Thomas Holaday for a little encouragement and a neat idea,
- Jay Miner (and friends) for the Amiga and
- My family for putting up with me programming while they baked
- their brains out on the beach.
-
- I couldn't have done it without you guys.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Copyright 1989 by Don Nafis & NAZLO Associates Limited. All rights reserved.c