Operating System - OpenVMS
1748272 Members
4254 Online
108760 Solutions
New Discussion

Re: run a job each 15 minutes

 
OmarSanchez
Occasional Contributor

run a job each 15 minutes

Hi

Reading about openvms, there is a DCL scripting language and submit command similar to crontab in unix.

that i want is create a bash.com to get the datetime "ps time", each 15 minutes. it job alway write into the same file.

myshell.com

output="/dir/file.txt"

$OUTPUT "ps time""

exit

cron

*/15 * * * * submit myshell.com

 

I appreciate your comments

thanks a lot.

 

 

 

 

3 REPLIES 3
Hoff
Honored Contributor

Re: run a job each 15 minutes

You're on OpenVMS, not Unix.  No cron.   No ps command, either.    As you've noticed, things work very differently.

For ps, SHOW PROCESS or SHOW SYSTEM, depending on what you're up to, or use a DCL loop and lexical functions.   (There are various examples of DCL loops around — some look through a directory, and show the basic structure, but you'll be using f$getjpi or f$getqui or some other lexical, if you're looking for something that ps might display.)

As for scheduling, you can either scrounge and install a cron tool, or acquire and install a commercial job scheduler, or can use the hack that many of us do and use periodic batch resubmissions, or — for something as short as fifteen minutes — just leave the procedure running and WAIT.

Writing the same filename doesn't work the same on OpenVMS as it does on Unix, either.   You'll accumulate versions, unless you manage that explicitly in the procedure, or via SET FILE or SET DIRECTORY with the /VERSION_LIMIT setting.

If you're more at home in bash as it appears (and depending on exactly what you're up to), then you might be better served by installing GNV and writing scripts there.   That's a mostly-faithful bash shell for OpenVMS, with many of the common bash shell commands.   There is a port of ps available in GNV, but AFAIK no cron analog.   

These HPE forums are pretty weak and are difficult to search and navigate — searching the archives of the comp.os.vms newsgroup will likely provide you with more than a little insight into what's available and how (and the content there goes back decades), or get a few news server account at Eternal September and a newsreader and post to comp.os.vms from there, or use the Google Groups interface to post..

Steven Schweda
Honored Contributor

Re: run a job each 15 minutes

> cron
> */15 * * * * submit myshell.com

   VMS lacks a "cron"-like scheduler.  The usual alternative method is
the self-resubmitting batch job.  See, for example:

      http://community.hpe.com/t5/x/x/m-p/6435726

   For some date-time basics: HELP DATE_TIME

   A delta time like "+0:15:00" is easy to use, but that tends to drift
forward.  You may need to do some fiddling around to get non-drifting
15-minute intervals.

abrsvc
Respected Contributor

Re: run a job each 15 minutes

I would tend to use the same procedure that loops as Hoff suggests in the first reply.  The reasoning for this is:

1) The loop would avaoid all process creation and deletion required for each periodic job.

2) A loop that calculates the time remaining until the next interval, will prevent the drift that Steve mentioned in the 2nd reply.

3) A single procedure looping can either leave the log file open and add lines only closing the file on "completion", or it can  open and close the file as needed inside the wait loop.

 

There should be plenty of examples of how to create a loop as well as the handling of delta times.

 

Dan