home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / os / vms / 19531 < prev    next >
Encoding:
Internet Message Format  |  1992-12-21  |  4.0 KB

  1. Path: sparky!uunet!munnari.oz.au!manuel.anu.edu.au!sserve!hhcs.gov.au!geemic
  2. From: geemic@hhcs.gov.au
  3. Newsgroups: comp.os.vms
  4. Subject: Re: F$getjpis
  5. Message-ID: <1992Dec19.023910.553@hhcs.gov.au>
  6. Date: 19 Dec 92 02:39:10 +1100
  7. References: <1992Dec18.064535.17632@sarah.albany.edu>
  8. Organization: Aust. Dept. Health, Housing and Community Services
  9. Lines: 124
  10.  
  11. In article <1992Dec18.064535.17632@sarah.albany.edu>, sw4847@albnyvms.bitnet writes:
  12. > Can anyone explain to me how the F$getjpi function works? Or tell me where to
  13. > find the info on the function?
  14. > Please Reply by E-mail because I don't read this group often.
  15. > Thanks
  16. >                             Scott Weinstein
  17. >                             University at Albany
  18.  
  19.  
  20. The following DCL program used to kill off given user processes makes
  21. use of the F$GETJPI lexical to determine determine username, process name and
  22. process mode.
  23.  
  24. Any help ?
  25.  
  26.  
  27. Mike Gee
  28. Brisbane, Australia.
  29.  
  30.  
  31. $ !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!
  32. $ ! Program : KILL.COM                                                        !
  33. $ ! Created : 02/04/1992 - Mike Gee (Brisbane)                                !
  34. $ ! Version : 1.0                                                             !
  35. $ ! Purpose : To stop all interactive processes for a given user              !
  36. $ ! Usage   : KILL <Username>                                                 !
  37. $ !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!
  38. $ !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!
  39. $    gosub Initialize
  40. $    gosub Check_Parameters
  41. $    gosub Check_Privilege
  42. $    gosub Stop_Processes
  43. $    exit
  44. $ !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!
  45. $ !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!
  46. $ !
  47. $ !
  48. $ Initialize:
  49. $ !~~~~~~~~~~
  50. $    pcount = 0
  51. $    pfound = "FALSE"
  52. $    cur_user = f$extract(10, f$length(f$user()) - 11, f$user())
  53. $    out := write sys$output
  54. $ return
  55. $ !
  56. $ !
  57. $ Check_Parameters:
  58. $ !~~~~~~~~~~~~~~~~
  59. $    if p1 .eqs. "" then goto No_Param
  60. $    if p2 .nes. "" then goto Too_Many_Param
  61. $    p1 = f$edit(p1, "UPCASE")
  62. $    if (p1 .eqs. "SYSTEM") 
  63. $       then 
  64. $       out "Authorization denied - Cannot stop system processes"
  65. $       exit
  66. $    endif
  67. $    if (p1 .eqs. "ORACLE") 
  68. $       then 
  69. $       out "Authorization denied - Cannot stop oracle processes"
  70. $       exit
  71. $    endif
  72. $    if (p1 .eqs. "ALLIN1") 
  73. $       then 
  74. $       out "Authorization denied - Cannot stop allin1 processes"
  75. $       exit
  76. $    endif
  77. $ return
  78. $ !
  79. $ !
  80. $ Check_Privilege:
  81. $ !~~~~~~~~~~~~~~~
  82. $    if .not. f$privilege("WORLD")
  83. $       then
  84. $       out "Authorization denied - World privilege required"
  85. $       exit
  86. $    endif
  87. $ return
  88. $ !
  89. $ !
  90. $ Stop_Processes:
  91. $ !~~~~~~~~~~~~~~
  92. $    out "             Terminating User Specified Processes"
  93. $    out "              For User at ", f$time()
  94. $    out ""
  95. $    get_next_pid:
  96. $       cur_pid = f$pid(context)
  97. $       user_mode := 'f$getjpi(cur_pid,"mode")
  98. $       if user_mode .nes. "INTERACTIVE" then goto get_next_pid
  99. $       if (cur_pid .nes. "")
  100. $          then 
  101. $          cur_username = f$getjpi(cur_pid, "USERNAME")
  102. $          cur_procname = f$getjpi(cur_pid, "PRCNAM")
  103. $          cur_username = f$edit(cur_username, "TRIM, UPCASE")
  104. $          cur_procname = f$edit(cur_procname, "TRIM, UPCASE")
  105. $          if (cur_username .eqs. p1) 
  106. $             then 
  107. $             pcount = pcount + 1
  108. $             pfound = "TRUE"
  109. $             out "                   ", cur_username, "   ", cur_procname 
  110. $             stop/id='cur_pid'
  111. $          endif
  112. $       endif
  113. $    if (cur_pid .nes. "") then goto get_next_pid
  114. $    if (.not. pfound) 
  115. $       then 
  116. $       out "             *** No matching username found ***"
  117. $    endif 
  118. $    out ""
  119. $    out "             Total Of (", pcount, ") Process(es) Terminated"
  120. $ return
  121. $ !
  122. $ !
  123. $ No_Param:
  124. $ !~~~~~~~~
  125. $    out "   Usage   : KILL <username>"
  126. $    out "   Example : KILL GEEMIC"
  127. $ exit
  128. $ !
  129. $ !
  130. $ Too_Many_Param:
  131. $ !~~~~~~~~~~~~~~
  132. $    out "   Error - too many parameters"
  133. $ exit
  134.  
  135.