home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / sys / sgi / 17942 < prev    next >
Encoding:
Internet Message Format  |  1992-12-12  |  1.2 KB

  1. Path: sparky!uunet!dtix!relay!relay2!afterlife!adm!news
  2. From: hofmann@nova.tat.physik.uni-tuebingen.de (Bernhard Hofmann)
  3. Newsgroups: comp.sys.sgi
  4. Subject: Re: finding out who's on the console
  5. Message-ID: <34621@adm.brl.mil>
  6. Date: 12 Dec 92 22:20:42 GMT
  7. Sender: news@adm.brl.mil
  8. Lines: 18
  9.  
  10. rcaslis@hydra.acs.uci.edu (Russell Caslis) writes:
  11.  
  12.  
  13. >Does anyone know an easy way to tell what user is sitting at the console?  I'm
  14. >converting a perl script of mine from SunOS to IRIX and I need to know which
  15. >user is logged into the console (if anyone).
  16.  
  17. I've hacked a little bash-function that does the job well enough for me.
  18. The idea (in case you're not using the bash :-) is to look at the end of
  19. /usr/adm/SYSLOG for a line containing 'Xsession:'. It contains all
  20. the information you need.
  21.  
  22. konsole() { if test `grep "Xsession:" /usr/adm/SYSLOG | tail -1 | awk -F: '{print $NF; printf "%s", $(NF-1) >"konsoleuser"}' | awk '{print $1}'` != "logout"; then echo -n "The console is used by"; cat konsoleuser; echo "."; else echo "The Console is unused."; fi; rm konsoleuser }
  23.  
  24. I'm aware that it's quick and dirty. If anybody has any suggestions for
  25. improvements, please let me know.
  26.  
  27. Bernhard
  28.