home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!munnari.oz.au!manuel.anu.edu.au!sserve!hhcs.gov.au!geemic
- From: geemic@hhcs.gov.au
- Newsgroups: comp.os.vms
- Subject: Re: F$getjpis
- Message-ID: <1992Dec19.023910.553@hhcs.gov.au>
- Date: 19 Dec 92 02:39:10 +1100
- References: <1992Dec18.064535.17632@sarah.albany.edu>
- Organization: Aust. Dept. Health, Housing and Community Services
- Lines: 124
-
- In article <1992Dec18.064535.17632@sarah.albany.edu>, sw4847@albnyvms.bitnet writes:
- > Can anyone explain to me how the F$getjpi function works? Or tell me where to
- > find the info on the function?
- > Please Reply by E-mail because I don't read this group often.
- > Thanks
- > Scott Weinstein
- > University at Albany
-
-
- The following DCL program used to kill off given user processes makes
- use of the F$GETJPI lexical to determine determine username, process name and
- process mode.
-
- Any help ?
-
-
- Mike Gee
- Brisbane, Australia.
-
-
- $ !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!
- $ ! Program : KILL.COM !
- $ ! Created : 02/04/1992 - Mike Gee (Brisbane) !
- $ ! Version : 1.0 !
- $ ! Purpose : To stop all interactive processes for a given user !
- $ ! Usage : KILL <Username> !
- $ !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!
- $ !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!
- $ gosub Initialize
- $ gosub Check_Parameters
- $ gosub Check_Privilege
- $ gosub Stop_Processes
- $ exit
- $ !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!
- $ !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!
- $ !
- $ !
- $ Initialize:
- $ !~~~~~~~~~~
- $ pcount = 0
- $ pfound = "FALSE"
- $ cur_user = f$extract(10, f$length(f$user()) - 11, f$user())
- $ out := write sys$output
- $ return
- $ !
- $ !
- $ Check_Parameters:
- $ !~~~~~~~~~~~~~~~~
- $ if p1 .eqs. "" then goto No_Param
- $ if p2 .nes. "" then goto Too_Many_Param
- $ p1 = f$edit(p1, "UPCASE")
- $ if (p1 .eqs. "SYSTEM")
- $ then
- $ out "Authorization denied - Cannot stop system processes"
- $ exit
- $ endif
- $ if (p1 .eqs. "ORACLE")
- $ then
- $ out "Authorization denied - Cannot stop oracle processes"
- $ exit
- $ endif
- $ if (p1 .eqs. "ALLIN1")
- $ then
- $ out "Authorization denied - Cannot stop allin1 processes"
- $ exit
- $ endif
- $ return
- $ !
- $ !
- $ Check_Privilege:
- $ !~~~~~~~~~~~~~~~
- $ if .not. f$privilege("WORLD")
- $ then
- $ out "Authorization denied - World privilege required"
- $ exit
- $ endif
- $ return
- $ !
- $ !
- $ Stop_Processes:
- $ !~~~~~~~~~~~~~~
- $ out " Terminating User Specified Processes"
- $ out " For User at ", f$time()
- $ out ""
- $ get_next_pid:
- $ cur_pid = f$pid(context)
- $ user_mode := 'f$getjpi(cur_pid,"mode")
- $ if user_mode .nes. "INTERACTIVE" then goto get_next_pid
- $ if (cur_pid .nes. "")
- $ then
- $ cur_username = f$getjpi(cur_pid, "USERNAME")
- $ cur_procname = f$getjpi(cur_pid, "PRCNAM")
- $ cur_username = f$edit(cur_username, "TRIM, UPCASE")
- $ cur_procname = f$edit(cur_procname, "TRIM, UPCASE")
- $ if (cur_username .eqs. p1)
- $ then
- $ pcount = pcount + 1
- $ pfound = "TRUE"
- $ out " ", cur_username, " ", cur_procname
- $ stop/id='cur_pid'
- $ endif
- $ endif
- $ if (cur_pid .nes. "") then goto get_next_pid
- $ if (.not. pfound)
- $ then
- $ out " *** No matching username found ***"
- $ endif
- $ out ""
- $ out " Total Of (", pcount, ") Process(es) Terminated"
- $ return
- $ !
- $ !
- $ No_Param:
- $ !~~~~~~~~
- $ out " Usage : KILL <username>"
- $ out " Example : KILL GEEMIC"
- $ exit
- $ !
- $ !
- $ Too_Many_Param:
- $ !~~~~~~~~~~~~~~
- $ out " Error - too many parameters"
- $ exit
-
-