home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / os / vms / 13650 < prev    next >
Encoding:
Text File  |  1992-08-14  |  2.8 KB  |  78 lines

  1. Newsgroups: comp.os.vms
  2. Path: sparky!uunet!haven.umd.edu!darwin.sura.net!wupost!cs.utexas.edu!sun-barr!ames!nsisrv!heavax.gsfc.nasa.gov!orlandini
  3. From: orlandini@heavax.gsfc.nasa.gov (Mauro Orlandini)
  4. Subject: Number of users logged on a cluster member: SOLUTION
  5. Message-ID: <14AUG199211263347@heavax.gsfc.nasa.gov>
  6. News-Software: VAX/VMS VNEWS 1.41    
  7. Sender: usenet@nsisrv.gsfc.nasa.gov (Usenet)
  8. Nntp-Posting-Host: heavax.gsfc.nasa.gov
  9. Organization: NASA/GSFC Laboratory for High Energy Astrophysics
  10. Date: Fri, 14 Aug 1992 16:26:00 GMT
  11. Lines: 65
  12.  
  13. I would like to thank you
  14.     Brian D. Reed    bdr@cbnewsg.cb.att.com
  15.     Steve (SPG6)     spg@sunquest.com
  16.     Rick Colombo     Colombo@fnal.fnal.gov
  17. for their answers to my request for obtaining the number of users currently
  18. logged on a cluster member from a DCL script.
  19.   The answer that works for me (I have not WORLD priviledges) is to fetch the
  20. output from the SHOW USER command.
  21.   If I had WORLD priviledge the use of the lexicals F$CONTEXT and F$PID would
  22. have been the better choice.
  23.   Below my signature I append the DCL file which does the job.
  24.  
  25. Thank you again,
  26. Mauro
  27.  
  28.  
  29. --
  30.   +--------+    Mauro Orlandini      |   
  31.   ||\    /||       Code 666          |   I find television very educating.      
  32.   || \  / ||         NASA            |   Every time somebody turns on a set, I
  33.   ||  \/  ||  Laboratory for High    |   go into the other room and read a book
  34.   +--------+  Energy Astrophysics    |                         Groucho Marx
  35. ================================================================================
  36. Internet:                       Bitnet:                         SPAN:
  37. orlandini@lheavx.gsfc.nasa.gov  orlandini@lheavx.span.nasa.gov  15426::orlandini
  38. $!
  39. $!   DCL file to extract the number of users currently logged on a cluster
  40. $! member. Without argument it gives the number of users logged on the local
  41. $! node. If the argument is * it will scan all the cluster members
  42. $!
  43. $! Mauro Orlandini  <orlandini@lheavx.gsfc.nasa.gov>
  44. $!                                                          14 Aug 1992
  45. $ IF P1 .EQS. "*" THEN GOTO TOTALCLUSTER
  46. $ IF P1 .EQS. ""
  47. $ THEN
  48. $  NODE = F$GETSYI("NODENAME")
  49. $ ELSE
  50. $  NODE = P1
  51. $ ENDIF
  52. $ GOSUB SHOWUSERS
  53. $ EXIT
  54. $TOTALCLUSTER:
  55. $ IF F$GETSYI("CLUSTER_MEMBER") .EQS. "FALSE" THEN GOTO NOT_CLUSTER
  56. $ CONTEXT = ""
  57. $START:
  58. $ ID = F$CSID (CONTEXT)
  59. $ IF ID .EQS. "" THEN EXIT
  60. $ NODE = F$GETSYI ("NODENAME",,ID)
  61. $ GOSUB SHOWUSERS
  62. $ GOTO START
  63. $NOT_CLUSTER:
  64. $ WRITE SYS$OUTPUT "Not a member of a cluster."
  65. $ EXIT
  66. $SHOWUSERS:
  67. $ SHOW USER/NODE='NODE'/OUT=SYS$SCRATCH:SHUS.TMP
  68. $ OPEN SHUS SYS$SCRATCH:SHUS.TMP
  69. $ READ SHUS LINE
  70. $ READ SHUS LINE
  71. $ START = F$LOCATE("=",LINE)
  72. $ END = F$LOCATE(",",LINE)
  73. $ USERS = F$EDIT(F$EXTRACT(START+1,END-START-1,LINE),"COLLAPSE")
  74. $ WRITE SYS$OUTPUT "The number of users on ''node' is ''users'"
  75. $ CLOSE SHUS
  76. $ DELETE/NOLOG/NOCONFIRM SYS$SCRATCH:SHUS.TMP;*
  77. $ RETURN
  78.