[613] | 1 | ZZRESJOB ;(KSO,PK) Kill a job by VMS PID ; DKA187 08/30/93 ; Compiled 04/22/97 06:19PM for M/WNT
|
---|
| 2 | ; +--------------------------------------------------------+
|
---|
| 3 | ; | Copyright 1986-1997 by InterSystems Corporation, |
|
---|
| 4 | ; | Cambridge, Massachusetts, U.S.A. |
|
---|
| 5 | ; | All rights reserved. |
|
---|
| 6 | ; | |
|
---|
| 7 | ; | Confidential, unpublished property of InterSystems. |
|
---|
| 8 | ; | |
|
---|
| 9 | ; | This media contains an authorized copy or copies |
|
---|
| 10 | ; | of material copyrighted by InterSystems and is the |
|
---|
| 11 | ; | confidential, unpublished property of InterSystems. |
|
---|
| 12 | ; | This copyright notice and any other copyright notices |
|
---|
| 13 | ; | included in machine readable copies must be reproduced |
|
---|
| 14 | ; | on all authorized copies. |
|
---|
| 15 | ; +--------------------------------------------------------+
|
---|
| 16 | BEGIN ;
|
---|
| 17 | N %D,%X,JOB,KJ,PROC
|
---|
| 18 | W !,"Force a process to quit Open M"
|
---|
| 19 | ASK R !!,"Process ID (? for status report): ",JOB:DTIME I JOB="" W ! Q
|
---|
| 20 | ; **MODIFICATION: ^%SS replaced with ^AAQSS...
|
---|
| 21 | I JOB="?" W ! D ^AAQSS G ASK
|
---|
| 22 | ; **************
|
---|
| 23 | S:0 JOB=JOB
|
---|
| 24 | D FIND
|
---|
| 25 | I 'KJ W $C(7)," [no such Open M process]" G ASK
|
---|
| 26 | I JOB=$J W $C(7),!,"This is your current process, not proceeding with kill." G ASK
|
---|
| 27 | S PROC="",$ZT="ASK1",PROC=$P($V(-1,JOB),"^",10)
|
---|
| 28 | ASK1 S $ZT=""
|
---|
| 29 | I PROC?2U1N S PROC="" ;network daemons can be killed
|
---|
| 30 | I PROC]"",PROC'="JOBSRV" D G ASK
|
---|
| 31 | . W $C(7),!,"Can NOT kill the "_PROC_" process. "
|
---|
| 32 | S ZZ=$ZU(4,KJ)
|
---|
| 33 | I ZZ=-1 W !,"Process not responding" G ASK
|
---|
| 34 | I ZZ=-2 W !,"Process died, not responding" G ASK
|
---|
| 35 | I ZZ=-3 W !,"Process already died" G ASK
|
---|
| 36 | I PROC="JOBSRV" G ASK
|
---|
| 37 | F I=1:1:5 H 1 D FIND G ASK:'KJ
|
---|
| 38 | W !,"Process failed to quit" G ASK
|
---|
| 39 | FIND S %D=JOB F KJ=0:0 S KJ=+$ZJ(KJ) Q:'KJ!(KJ=%D)
|
---|
| 40 | Q
|
---|
| 41 | INT(JOB) ;EXTRINSIC FUNCTION. GIVEN JOB=PROCESS ID#. QUITS 1 IF TERMINATES, ELSE QUITS 0. (LIBERMAN) APR87
|
---|
| 42 | S:0 JOB=JOB
|
---|
| 43 | N %D,%X,I,KJ D FIND I 'KJ Q 0 ;QUIT 0 IF CANNOT FIND THAT PROCESS
|
---|
| 44 | I $ZU(4,KJ)=1 F I=1:1:5 H 1 D FIND G Q1:'KJ
|
---|
| 45 | Q 0 ;PROCESS DEAD OR NOT RESPONDING
|
---|
| 46 | Q1 Q 1
|
---|