home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!dtix!relay!relay2!afterlife!adm!news
- From: hofmann@nova.tat.physik.uni-tuebingen.de (Bernhard Hofmann)
- Newsgroups: comp.sys.sgi
- Subject: Re: finding out who's on the console
- Message-ID: <34621@adm.brl.mil>
- Date: 12 Dec 92 22:20:42 GMT
- Sender: news@adm.brl.mil
- Lines: 18
-
- rcaslis@hydra.acs.uci.edu (Russell Caslis) writes:
-
-
- >Does anyone know an easy way to tell what user is sitting at the console? I'm
- >converting a perl script of mine from SunOS to IRIX and I need to know which
- >user is logged into the console (if anyone).
-
- I've hacked a little bash-function that does the job well enough for me.
- The idea (in case you're not using the bash :-) is to look at the end of
- /usr/adm/SYSLOG for a line containing 'Xsession:'. It contains all
- the information you need.
-
- 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 }
-
- I'm aware that it's quick and dirty. If anybody has any suggestions for
- improvements, please let me know.
-
- Bernhard
-