Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1858
  • Last Modified:

Script in OPEN VMS to kill sessions

Hi I am looking to create a script in OPENVMS, ujuu. To kill the session of one user from one computer.
To see the users I use this command

$ sh user/full
      OpenVMS User Processes at  2-APR-2009 11:18:25.67
    Total number of users = 1,  number of processes = 1

 Username Process Name    PID     Terminal
 SYSTEM   SYSTEM        000038B6  TNA1015: (Host: 14.25.101.43     Port: 1980 )
 SYSTEM   SYSTEM        000037B6  TNA1015: (Host: 14.25.102.53     Port: 1980 )
 SYSTEM   SYSTEM        000036B6  TNA1015: (Host: 14.25.101.43     Port: 1980 )
 SYSTEM   SYSTEM        000035B6  TNA1015: (Host: 14.25.102.53     Port: 1980 )

$

Now I want to take the PID that user connected from one HOST. Example only that 14.25.102.53.

any idea, in UNIX I can use grep, but it doesn't exist

Thanks
Edu
0
ealcaniz
Asked:
ealcaniz
  • 7
  • 4
1 Solution
 
3_SCommented:
Hi,

The VMS equivalent of grep is the command search.
I guess you are trying to place the output of  sh user/full to a file and then kill all processes? Is this correct?
0
 
ealcanizAuthor Commented:
Yes I want to kill the process of one host. I will see search
0
 
ealcanizAuthor Commented:
I can get the lines

pipe sh users/full | search SYS$INPUT "10.1.1.1"

but how I can get only the column of PID?

0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
dolomitiCommented:
hi,
all systems have in the order:
kernel,
api,
commands (prebuilt programs written in C, in Usnix in MacroAssembler or C for VMS that uses api)
shell (DCL in VMS)

You can use scripts (DCL commands in VMS) that use commands and DCL primitive (IF,GOTO,SUB)
You can write program using C and call SystemServices and/or RunTimeLibrary

Shell in VMS is not powerfull as in Unix, but VMS has a level that in Unix you don'find:
here they are called Lexicla Function.
I unix the approach is different: the output command are straight and using commands as
grep, ! (pipe), awk,... you can with elegance, build a thing in 10 different way.

In VMS the way is more direct and often unic: to kill a process or you know the id or you have to list all.
To do this you have to call (iteretively) the system service $GETPRJ, you can write a compiled program,
(hard) or you can use Lex: more or less, exist a Lex for each important System Service.
During the loop, you can know exact info (by other LEx) about process.
Between these you find host,username,type of process (batch,interactive,network) and PID.
When you find the one you want, kill it using STOP/id...
This is the way.
Today I am not able to give you an example or the script.
But if you like to discover them by yourself this may be enough.
Next days, I can be able to retrive commands to do it.

bye
vic
0
 
ealcanizAuthor Commented:
Thanks vic, it will be wonderfull if you should find the commands, because I am reading and reading with DCL and Lex, .. if very very messy. Like you said before UNIX is more elegant.
0
 
ealcanizAuthor Commented:
Please any example.
0
 
dolomitiCommented:
hi ealcaniz,
sorry for late, but probably good news.
Warning to the space after ipaddress "192.168.5.132 ", between 2 and "

some rows are unnecessary, but I leave them for other cases.
I have not deeply tested, call it beta release!

bye
vic
$ context = ""
$ start:
$   pid = F$PID(context)
$   IF pid .EQS. "" THEN EXIT
$   Mode =      F$GETJPI( pid, "MODE" )
$   IF Mode .NES. "INTERACTIVE" THEN GOTO START
$   Utente    = F$GETJPI( pid, "USERNAME" )
$   Terminale = F$GETJPI( pid, "TERMINAL" )
$   x =         F$GETJPI( pid, "TT_PHYDEVNAM" )
$   PortNam =   F$GETJPI( pid, "TT_ACCPORNAM" )
$   SHOW SYMBOL pid
$   SHOW SYMBOL Utente
$   SHOW SYMBOL Terminale
$   SHOW SYMBOL x
$   SHOW SYMBOL PortNam
$   SHOW SYMBOL Mode
$   Len = F$LENGTH(PortNam)
$   Pos = F$LOCATE( "192.168.5.132 ", PortNam )
$   IF Pos .LT. Len THEN WRITE SYS$OUTPUT ">>>>>>>>>>>>>>>>>>>>>> Bingo"
$   IF Pos .LT. Len THEN STOP /IDENTIFICATION='pid'
$   WRITE SYS$OUTPUT "----------------------------------"
$   GOTO start

Open in new window

0
 
ealcanizAuthor Commented:
Thanks a million. I am tested for myself, Give me a error

$ start:
%DCL-W-NOLBLS, label ignored - use only within command procedures
 \START:\

For this thing I think is not working the loop. Only give blank in the symbol.

0
 
ealcanizAuthor Commented:
OK. solve this thing it was to put in UpperCase, but When I run the program doesn't give me information


SHOW SYMBOL Utente
  SHOW SYMBOL Terminale
  SHOW SYMBOL x
  SHOW SYMBOL PortNam
  SHOW SYMBOL Mode


PortNam and the rest is blank.  
0
 
dolomitiCommented:
hi ealcaniz,
sorry if I have not been clear:
what I sent you is a script:
create a file (by edit/etd or edit/tpu) ie named KILLER.COM and write inside what I sent you
save it

at DCL level (system user right) enter

@KILLER

for first time launch it as is without change ip address: you will see a list of interactive process.
if it run, put a right address.

bye
vic
0
 
dolomitiCommented:
hi ealcaniz,

any news about script ?

bye
vic
0
 
ealcanizAuthor Commented:
Sorry delay but it's working successfully only I have to use nameserver instead IP
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 7
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now