Re: Which processes use shared image
- From: Jim Duff <spam.this@xxxxxxxxx>
- Date: Tue, 23 Jun 2009 07:46:42 +1000
Eirrub wrote:
Hello,
Does someone know how you can find the processes which are making use
of a specific shared image?
Thanks,
Frank Burrie.
The usual reason for wanting this information is that you want to
de-install a shared image that someone has open, and because it's
installed /SHARE, SHOW DEV/FILES does not provide you with the
information to locate the process.
Unfortunately, as far as I know there's no "easy" way to find processes
that have channels open in this situation.
Here's a DCL command procedure that brute forces the solution using
SDA's SHOW PROCESS/CHANNEL command:
$! See bottom of file for comments.
$ set on
$ on warning then goto error
$ on control_y then goto error
$ say := write sys$output
$ ask := read/error=error/end_of_file=error sys$command -
command/prompt=
$ do_header = 1
$ required_privs = "WORLD, CMKRNL"
$ old_privs = f$setprv (required_privs)
$ if .not. f$privilege (required_privs)
$ then
$ say "Required privileges: " + required_privs
$ goto exit
$ endif
$ask_p1:
$ image = f$edit (p1, "uncomment, collapse")
$ if image .eqs. ""
$ then
$ ask "Image to search for? "
$ p1 = command
$ goto ask_p1
$ endif
$ if f$search (image) .eqs. ""
$ then
$ say "Can't find image: " + image
$ p1 = ""
$ goto ask_p1
$ endif
$ image = "]" + f$parse (image,,,"name") + -
f$parse (image,,,"type") + ";"
$
$ context = ""
$ temp1 = "sys$scratch:" + f$unique() + ".tmp"
$ temp2 = "sys$scratch:" + f$unique() + ".tmp"
$loop:
$ pid = f$pid (context)
$ if pid .eqs. ""
$ then
$ goto end_loop
$ endif
$ open/write out 'temp1'
$ write out "$ define/user sys$output nl:"
$ write out "$ define/user sys$error n:"
$ write out "$ analyze/system"
$ write out "$ deck"
$ write out "set output " + temp2
$ write out "show process/channel/index=" + pid
$ write out "exit"
$ write out "$ eod"
$ write out "$ exit"
$ close out
$ @'temp1'
$ delete/nolog 'temp1';*
$ define/user sys$output nl:
$ define/user sys$error nl:
$ search 'temp2' "''image'"
$ if f$integer ($status) .eq. 1
$ then
$ if do_header
$ then
$ do_header = 0
$ say "PID Process"
$ endif
$ say pid + " " + f$getjpi (pid, "prcnam")
$ endif
$ delete/nolog 'temp2';*
$ goto loop
$end_loop:
$ goto exit
$error:
$ set noon
$exit:
$ if f$trnlnm ("out") .nes. ""
$ then
$ close out
$ endif
$ if f$type (temp1) .nes. ""
$ then
$ if f$search (temp1) .nes. ""
$ then
$ delete/nolog 'temp1';*
$ endif
$ endif
$ if f$type (temp2) .nes. ""
$ then
$ if f$search (temp2) .nes. ""
$ then
$ delete/nolog 'temp2';*
$ endif
$ endif
$ old_privs = f$setprv (old_privs)
$ exit
$!++
$!
$! DESCRIPTION
$!
$! This command procedure, given the name of an image file
$! (or any file for that matter) uses SDA's SHOW PROCESS/CHANNEL
$! command to locate processes that have an open channel to
$! files of that name. Note only the file name and type are
$! matched, but this will usually be quite enough to locate the
$! process you are looking for (and that way I don't have to get
$! into messy file parsing and searching).
$!
$! AUTHOR
$!
$! James F. Duff
$!
$! DATE
$!
$! 23-Jun-2009
$!
$! MODIFICATIONS
$!
$! X01-00 Jim Duff 23-Jun-2009
$! Original version of module.
$!
$!--
HTH,
Jim.
--
www.eight-cubed.com
.
- Follow-Ups:
- Re: Which processes use shared image
- From: David J Dachtera
- Re: Which processes use shared image
- References:
- Which processes use shared image
- From: Eirrub
- Which processes use shared image
- Prev by Date: Re: Fiewalls on VMS
- Next by Date: Re: Fiewalls on VMS
- Previous by thread: Re: Which processes use shared image
- Next by thread: Re: Which processes use shared image
- Index(es):
Relevant Pages
|