home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.os.vms
- Path: sparky!uunet!haven.umd.edu!darwin.sura.net!wupost!cs.utexas.edu!sun-barr!ames!nsisrv!heavax.gsfc.nasa.gov!orlandini
- From: orlandini@heavax.gsfc.nasa.gov (Mauro Orlandini)
- Subject: Number of users logged on a cluster member: SOLUTION
- Message-ID: <14AUG199211263347@heavax.gsfc.nasa.gov>
- News-Software: VAX/VMS VNEWS 1.41
- Sender: usenet@nsisrv.gsfc.nasa.gov (Usenet)
- Nntp-Posting-Host: heavax.gsfc.nasa.gov
- Organization: NASA/GSFC Laboratory for High Energy Astrophysics
- Date: Fri, 14 Aug 1992 16:26:00 GMT
- Lines: 65
-
- I would like to thank you
- Brian D. Reed bdr@cbnewsg.cb.att.com
- Steve (SPG6) spg@sunquest.com
- Rick Colombo Colombo@fnal.fnal.gov
- for their answers to my request for obtaining the number of users currently
- logged on a cluster member from a DCL script.
- The answer that works for me (I have not WORLD priviledges) is to fetch the
- output from the SHOW USER command.
- If I had WORLD priviledge the use of the lexicals F$CONTEXT and F$PID would
- have been the better choice.
- Below my signature I append the DCL file which does the job.
-
- Thank you again,
- Mauro
-
-
- --
- +--------+ Mauro Orlandini |
- ||\ /|| Code 666 | I find television very educating.
- || \ / || NASA | Every time somebody turns on a set, I
- || \/ || Laboratory for High | go into the other room and read a book
- +--------+ Energy Astrophysics | Groucho Marx
- ================================================================================
- Internet: Bitnet: SPAN:
- orlandini@lheavx.gsfc.nasa.gov orlandini@lheavx.span.nasa.gov 15426::orlandini
- $!
- $! DCL file to extract the number of users currently logged on a cluster
- $! member. Without argument it gives the number of users logged on the local
- $! node. If the argument is * it will scan all the cluster members
- $!
- $! Mauro Orlandini <orlandini@lheavx.gsfc.nasa.gov>
- $! 14 Aug 1992
- $ IF P1 .EQS. "*" THEN GOTO TOTALCLUSTER
- $ IF P1 .EQS. ""
- $ THEN
- $ NODE = F$GETSYI("NODENAME")
- $ ELSE
- $ NODE = P1
- $ ENDIF
- $ GOSUB SHOWUSERS
- $ EXIT
- $TOTALCLUSTER:
- $ IF F$GETSYI("CLUSTER_MEMBER") .EQS. "FALSE" THEN GOTO NOT_CLUSTER
- $ CONTEXT = ""
- $START:
- $ ID = F$CSID (CONTEXT)
- $ IF ID .EQS. "" THEN EXIT
- $ NODE = F$GETSYI ("NODENAME",,ID)
- $ GOSUB SHOWUSERS
- $ GOTO START
- $NOT_CLUSTER:
- $ WRITE SYS$OUTPUT "Not a member of a cluster."
- $ EXIT
- $SHOWUSERS:
- $ SHOW USER/NODE='NODE'/OUT=SYS$SCRATCH:SHUS.TMP
- $ OPEN SHUS SYS$SCRATCH:SHUS.TMP
- $ READ SHUS LINE
- $ READ SHUS LINE
- $ START = F$LOCATE("=",LINE)
- $ END = F$LOCATE(",",LINE)
- $ USERS = F$EDIT(F$EXTRACT(START+1,END-START-1,LINE),"COLLAPSE")
- $ WRITE SYS$OUTPUT "The number of users on ''node' is ''users'"
- $ CLOSE SHUS
- $ DELETE/NOLOG/NOCONFIRM SYS$SCRATCH:SHUS.TMP;*
- $ RETURN
-