Title: | -={ H A C K E R S }=- |
Notice: | Write locked - see NOTED::HACKERS |
Moderator: | DIEHRD::MORRIS |
Created: | Thu Feb 20 1986 |
Last Modified: | Mon Aug 03 1992 |
Last Successful Update: | Fri Jun 06 1997 |
Number of topics: | 680 |
Total number of notes: | 5456 |
Good day. I am trying to have a batch job get notified of certain events that are not directly within its command stream. For example, I would like to have the batch file know when a PRINT job has completed; similar to a PRINT/NOTIFY for an interactive process. One horrific approach might be to copy the file to a temporary file (based on a time string) and issue a PRINT/DELETE. Then, loop (with a wait) until the file can no longer be found. When it is no longer found, the assumption would be that the file has indeed finished printing. However, I wouldn't like to have to wait in a loop until the print completed, so this is not really what I want. Would any one out there have a good idea at a different and better approach? Thanks, Wim
T.R | Title | User | Personal Name | Date | Lines |
---|---|---|---|---|---|
170.1 | EXPERT::CLARKE | Tue Oct 22 1985 13:48 | 14 | ||
No hacking necessary here - DCL has a SYNCHRONIZE command. Suppose you have issued the following (either within your batch command file or before you did the SUBMIT or even from another process under your account) - $ print/que=<queue-name>/name=<unique-job-name> file.ext Then in your batch stream, use - $ synchronize/que=<queue-name> <unique-job-name> Your batch process will sleep until the specified job completes. Mat. | |||||
170.2 | R2ME2::GILBERT | Tue Oct 22 1985 15:20 | 22 | ||
Hi, Wim. If SYNCHRONIZE will do the trick, or if an AST can be delivered when the event occurs, wonderful. If the batch job needs to catch a broadcast message, c'est domage (too bad). For more complex events, you may want to use mailboxes, with the process that causes the event (or able to recognize when the event occurred) sending a message to the batch job. Locks (and the lock manager) could also be used. For a hack, you could even use logical names: $loop: wait 00:01:00 $ if f$logical("wim$event") .eqs. "" then goto loop $ 'f$logical("wim$event") ! Interesting & useful, but unnecessary A job, group or system-wide logical name can be used to indicate the occurence of an event, and give extra information (note that there are no read-modify primitives for logical names, so you could miss events that occur at roughly the same time as another event). Notice the difference between asynchronous notification and polling used in the various approaches. | |||||
170.3 | VAXUUM::DYER | Wed Oct 23 1985 04:33 | 13 | ||
I'd probably use the method in Reply #1 just a tad differ- ently. After doing this: $ define/user sys$output FOOBAR.TMP $ print/queue=<queue-name> FILE.EXT I would read in the line from FOOBAR.TMP and find the entry number and I would use SYNCHRONIZE like this: $ synchronize/queue=<queue-name>/entry=<entry-name> Whatever floats your boat . . . <_Jym_> | |||||
170.4 | Has 2 years made a difference? | CADSYS::HEBERT | Fri Sep 25 1987 18:52 | 19 | |
Sorry to open up a 2-year-old topic. But I was wondering about the same thing recently. Specifically, I have a batch job which submits several other batch jobs and wants to wait until they are all complete AND get the status for each job. Is there NO way to fake out the system and make it think that the process has a terminal associated with it and a mailbox associated with that? My current solution is using pipes to communicate and a tickler subprocess to keep the main job from hanging around forever if a job exits without responding with its status for some reason. But this means that all the jobs have to run on the same machine (I'm in a cluster). If I could set up a mailbox to catch the notification messages then the main job find out more easily if a process terminates abnormally or aborts ... Or if someone can come up with similar functionality from a different tack ... Thanx ever so large ... Chris H�bert |