home *** CD-ROM | disk | FTP | other *** search
- /***********************/
- /* NCAdd.rexx */
- /* 7/20/89 - Don Nafis */
- /***********************/
-
- /* This script demonstrates loading the NazCron event list from Arexx,
- using a CRONTAB file. There is no real advantage to using this
- method to load a new CRONTAB file other than to allow some pre-
- processing of the file in the ARexx script. Otherwise it would
- be much faster to use the NEW_EVENT_FILE command to introduce a
- new CRONTAB. You could, of course, use this technique to load
- multiple CRONTAB files, using ARexx to determine which file(s)
- to load.
-
- Usage:
- rx NCNew filename
- where
- filename must be the full file path of the new CRONTAB file.
- */
-
- /* Remove the comments below to trace this script. */
- /*--->trace results<---*/
-
- options failat 20
-
- arg crontabname
- if (crontabname == '') then
- do
- say
- say ' Usage: rx NCAdd crontabfilename'
- say
- exit 20
- end
-
- if (open(crontabfile,crontabname) ~= 1) then
- do
- say
- say " I could not find file: " || crontabname || "."
- say
- exit 20
- end;
-
-
- address NAZCRON
-
- cronrec = readln(crontabfile)
-
- if (~EOF(crontabfile)) then
- do
- say
- say 'Adding NazCron statements from file: '||crontabname
- say
- end
- else
- do
- say ' NazCron event file '||crontabname||' is empty.'
- say
- close(crontabfile)
- exit 5
- end
-
- do while (~EOF(crontabfile))
-
- /*
- * This is where you would put your pre-processing code.
- */
-
- 'ADD_EVENT '||cronrec
-
- if (rc ~= 0) then
- do
- say ' NazCron ADD_EVENT failure.'
- say
- say ' ->'|| cronrec
- say ' Return code: '|| rc
- say
- close(crontabfile)
- exit 20
- end
- else
- do
- say '->'||cronrec
- cronrec = readln(crontabfile)
- end
- end
-
- close(crontabfile)
- say
-
- exit 0
-