Как определить дополнительные сеансы терминала OpenVMS и затем прекратить их?

654
C.W.Holeman II

Команда OpenVMS DCL показывает, что у меня три активных сеанса.

$ show users OpenVMS User Processes at 12-OCT-2014 20:44:29.57 Total number of users = 3, number of processes = 6  Username Node Interactive Subprocess Batch CWHII ROSIE 3 EFRICHA ROSIE 1 HEINER ROSIE 2 

Как мне определить два старых и затем прекратить их?

2

2 ответа на вопрос

1
Hein

Hmmm, I typically use ^T (control-T) to see 'who am I' and $ SHOW US CWHII/FULL. Then shoot to kill as needed.

If we assume 'old', to mean NOT the current session, then you script that as follows:

$ type CLEAN_ME_UP.COM $ ctx = "" $ this = F$GETJPI( "", "PRCNAM" ) $ user = F$GETJPI( "", "USERNAME" ) $ node = F$GETJPI( "", "NODENAME" ) $ temp = F$CONTEXT( "PROCESS", ctx, "USERNAME", user, "EQL" ) $ temp = F$CONTEXT ("PROCESS", ctx, "NODENAME", node, "EQL") $! IF F$TYPE( ctx ) .NES. "PROCESS_CONTEXT" THEN EXIT $loop: $ pid = F$PID( ctx ) $ IF pid .EQS. "" THEN EXIT $ that = F$GETJPI( pid, "PRCNAM" ) $ IF this.EQS.that $ THEN $ WRITE SYS$OUTPUT pid, " new" $ ELSE $ WRITE SYS$OUTPUT pid, " old" $ ENDIF $ GOTO loop 
  • Of course you want to replace the WRITE SYS$OUTPUT with STOP/ID once satisfied.
  • Remove the NODE context if you want to do this for all older processes on every node.
  • Consider F$GETJPI( "", "LOGINTIM") if you really want to use 'older' (shoot in foot?)

Cheers, Hein

re-formatted:

$ ctx = "" $ this = F$GETJPI( "", "PRCNAM" ) $ temp = F$CONTEXT( "PROCESS", ctx, "USERNAME", F$GETJPI("","USERNAME"), "EQL" ) $ temp = F$CONTEXT ("PROCESS", ctx, "NODENAME", F$GETJPI("","NODENAME"), "EQL") $! IF F$TYPE( ctx ) .NES. "PROCESS_CONTEXT" THEN EXIT $loop: $ pid = F$PID( ctx ) $ IF pid .EQS. "" THEN EXIT $ IF F$GETJPI( pid, "PRCNAM" ).NES.F$GETJPI("", "PRCNAM") THEN WRITE SYS$OUTPUT "STOP ",pid $ GOTO loop 
1
C.W.Holeman II

Identify all of the processes you are running.

$ SHOW USER CWHII/FULL OpenVMS User Processes at 13-OCT-2014 16:13:46.49 Total number of users = 1, number of processes = 3 Username Node Process Name PID Terminal CWHII ROSIE CWHII 20200117 TZA44: (108.225.238.117) CWHII ROSIE _TZA18: 202000B4 TZA18: (108.225.238.117) CWHII ROSIE _TZA33: 202000C9 TZA33: (108.225.238.117) 

Identify the current one's Process Name by requesting a DCL interrupt and status report by doing a Control-T.

$ ^T ROSIE::CWHII 16:13:49 (DCL) CPU=00:02:48.66 PF=15943 IO=9693 MEM=245 

Kill the two that do not have that Process Name.

$ STOP/IDENTIFICATION=202000B4 $ STOP/IDENTIFICATION=202000C9 

The lower PIDs on the two confirm that they are the older processes.

This is information for an interactive method for reference w/o using a script based upon the information in Hein's answer.

Похожие вопросы