Operating System - OpenVMS
cancel
Showing results for 
Search instead for 
Did you mean: 

OpenVMS automatically

MPIvan
Occasional Advisor

OpenVMS automatically

Hi all,

 

I would like to ask some stupid question. Im a new to OpenVMS and I have running a command procedure or let me say script. This script is run like this: submit /noprint script_name    and it generate a log file. So I would like to add another thing or make new script that after it finish the log file will be send on mail. The procedure is long and running more then 2 hours. So afther its done to send me the log file or after 2 hours or 3 to send me the log file on mail. also i would like to make this automaticaly, for example this script to run automaticaly every day at 17h oclock 

5 REPLIES
Bob Blunt
Respected Contributor

Re: OpenVMS automatically

The question isn't stupid but it could have been answered with HELP SUBMIT.  Unfortunately there isn't a command qualifier that would mail the logfile to you.  The easiest solution, from my point of view, would be to write another simple command procedure that contains the $ SUBMIT/NOPRINT command you're issuing to run the job.  For most circumstances you could use the SYNCH command to wait for the job to finish and then have a command to use MAIL to send the logfile to you.

 

bob

abrsvc
Respected Contributor

Re: OpenVMS automatically

The simplist way to accomplish this is to submit a com file with the following:

1) Submit (actual job)
2) SYNC on the above job
3) $mail/subj="whatever" /to="whomever" logfile_from_above


Note: The SYNC will cause the current stream to wait until the batch job is complete. At that point, the mail will be sent.

I use a similar mechanism.

Dan
Craig A Berry
Honored Contributor

Re: OpenVMS automatically

You can redirect the middle of your log to another file, close it, and then mail that file, like the following, which will send you an e-mail consisting entirely of "Do stuff here":

 

$ type mail_batch_log.com
$ IF F$SEARCH("SYS$SCRATCH:my_batch_log.tmp") .NES. ""
$ THEN
$    DELETE SYS$SCRATCH:my_batch_log.tmp;*
$ ENDIF
$ OPEN/WRITE/SHARE=READ OUTFILE SYS$SCRATCH:my_batch_log.tmp
$ DEFINE/NOLOG SYS$OUTPUT OUTFILE
$ DEFINE/NOLOG SYS$ERROR OUTFILE
$!***
$ WRITE SYS$OUTPUT "Do stuff here"
$!***
$ ALL_DONE:
$ CLOSE/NOLOG OUTFILE
$ MAIL/SUBJECT= "Results from MY_BATCH_LOG" -
        SYS$SCRATCH:MY_BATCH_LOG.TMP 'F$GETJPI("","USERNAME")'
$ EXIT

 

There are a bunch of holes in this simple example, such as the lack of error handling, and the failure to dodge race conditions by giving the scratch file a unique name, but it should get you started.

MPIvan
Occasional Advisor

Re: OpenVMS automatically

Hi all and tnx for the reply ... i would like to tell that im a total noob in this :) im trying to learn how it works. Any way sorry for long time no reply and i guess it left to me to try ... Also i have to tell that if the tape where it is saving the backup may be out of memory and then the log stops and i have to know that too so i can react ... but i guess can be left off and wait for mail :) and if it not coming then to chekit :) ... 

abrsvc
Respected Contributor

Re: OpenVMS automatically

You appear to be requesting a number of different but related things here.

You mention that you would like the procedure to start every day at the same time. To accomplish this, submit the same procedure to the batch queue using the /AFTER qualifier and specify "tomorrow+X" where X is the time you would like the procedure to start. For example: /AFTER="tomorrow+05:00" would start the job at 5AM the next day.

In your last reply, you imply that you are doing backups and that the tape may run out of space requiring another tape. Enabling your terminal for operator messages will allow the operator messages to appear on your terminal. Messages requesting another tape will appear there.

Hope this helps,
Dan