[Info-vax] Check if a process will auto-terminate
AEF
spamsink2001 at yahoo.com
Thu Apr 30 22:18:20 EDT 2009
On Apr 30, 9:48 pm, AEF <spamsink2... at yahoo.com> wrote:
> On Apr 30, 1:27 pm, "Stephen Davies" <no... at nowhere.com> wrote:
>
>
>
> > "AEF" <spamsink2... at yahoo.com> wrote in message
>
> >news:83c3a47f-8702-47c1-a19c-e112a0fc3b9d at s1g2000prd.googlegroups.com...
>
> > >Steve,
>
> > >Does this do what you need?
>
> > >$ TYPE CMD*.COM
>
> > >DISK$DATA1:[FELDMAN.VMS.DCL.SPAWN]CMD.COM;1
>
> > >$ SPAWN/NOWAIT @CMD_SUB.COM
> > >$_WAIT:
> > >$ WAIT 0:00:01
> > >$ NUMSUB = F$GETJPI("","PRCCNT")
> > >$ IF (NUMSUB.GT.0) THEN GOTO _WAIT
>
> > Alas no, because that would mean that CMD always waits for
> > CMD_SUB to finish.
>
> > What I want is for CMD to do "spawn/nowait @CMD_SUB" and
> > then exit when called like this:
> > $ @CMD
>
> > or like this:
> > $ spawn
> > $ @CMD
>
> > But I want CMD to wait for CMD_SUB when called like this:
> > $ spawn @CMD
>
> > or like this:
> > $ spawn /nowait @CMD
>
> Does this do what you want? (Put commands for the CMD.COM in part 1
> and those for CMD_SUB.COM in part 2.)
>
> $ TYPE CMD2.COM
> $ IF (P1.EQ.1) THEN GOTO PART1
> $ IF (P1.EQ.2) THEN GOTO PART2
> $ SPAWN @CMD2.COM 1
> $ SPAWN @CMD2.COM 2
> $ EXIT
> $
> $PART1:
> $ WRITE SYS$OUTPUT "PART 1 HERE"
> $ EXIT
> $
> $PART2:
> $ WRITE SYS$OUTPUT "PART 2 HERE"
> $ EXIT
> $
>
> It's late. I hope I got it right! :-)
>
> The only problem I see is that you don't get the prompt string for the
> first command you run after the SPAWN/NOWAIT run. 'Hope that's not a
> problem!
>
> AEF
Oops, that runs them in series. You want them in parallel, right? And
you can modify only CMD2.COM, right?
OK, here's effort no. 2. The only thing is that you need to add
something like my previous effort to check when both subprocesses are
done.
DCL> type cmd2.com
$ IF (P1.EQ.1) THEN GOTO PART1
$ IF (P1.EQ.2) THEN GOTO PART2
$ SPAWN/NOWAIT @CMD2.COM 1
$ SPAWN/NOWAIT @CMD2.COM 2
$ ! Replace the following line with code that checks when the two
$ ! subprocesses are done:
$ WAIT 0:00:06
$ EXIT
$
$PART1:
$ WRITE SYS$OUTPUT "PART 1 BEG"
$ SHOW TIME
$ WAIT 0:00:03
$ SHOW TIME
$ WRITE SYS$OUTPUT "PART 1 END"
$ EXIT
$
$PART2:
$ WRITE SYS$OUTPUT "PART 2 BEG"
$ SHOW TIME
$ WAIT 0:00:03
$ SHOW TIME
$ WRITE SYS$OUTPUT "PART 2 END"
$ EXIT
DCL>
Trial runs:
DCL> @CMD2
%DCL-S-SPAWNED, process FELDMAN_1 spawned
PART 1 BEG
1-MAY-2009 02:14:08
%DCL-S-SPAWNED, process FELDMAN_2 spawned
PART 2 BEG
1-MAY-2009 02:14:08
1-MAY-2009 02:14:11
PART 1 END
1-MAY-2009 02:14:11
PART 2 END
DCL>
DCL> SPAWN @CMD2
%DCL-S-SPAWNED, process FELDMAN_1 spawned
%DCL-S-ATTACHED, terminal now attached to process FELDMAN_1
%DCL-S-SPAWNED, process FELDMAN_2 spawned
PART 1 BEG
1-MAY-2009 02:14:19
%DCL-S-SPAWNED, process FELDMAN_3 spawned
PART 2 BEG
1-MAY-2009 02:14:19
1-MAY-2009 02:14:22
PART 1 END
1-MAY-2009 02:14:22
PART 2 END
%DCL-S-RETURNED, control returned to process _NTA2:
DCL>
DCL> SPAWN/NOWAIT @CMD2
%DCL-S-SPAWNED, process FELDMAN_1 spawned
%DCL-S-SPAWNED, process FELDMAN_2 spawned
DCL>
PART 1 BEG
1-MAY-2009 02:14:31
%DCL-S-SPAWNED, process FELDMAN_3 spawned
PART 2 BEG
1-MAY-2009 02:14:32
1-MAY-2009 02:14:34
PART 1 END
1-MAY-2009 02:14:35
PART 2 END
DCL>
AEF
More information about the Info-vax
mailing list