Subject: Re: How to determine which Mac s are connected?

From: [email-masked]
Date: Thu, 23 Mar 2000 11:32:37 -0500

Patrik Schindler, [email-masked] writes:

>Indeed, a little goodie to keep track which users were connected from 
>which machines would be nice, but I have no idea to keep track of 
>AppleTalk users.

Here's a shell script for Linux users of netatalk which will associate 
users with their netatalk login data, which includes machine addresses, 
either IP or Appletalk.  Put it in your /usr/local/sbin directory, and 
make it executable.  Then, run it either with "sudo" or while logged in 
as root and pipe the output to your favorite pager program.

-------------------cut here-----------------
#!/bin/sh
# Must be run as superuser.
#
# set up the raw work files
ps aux |
  grep afpd |
  grep -v grep |
  awk '{print $2, $1}' |
  sort -k 1 > /tmp/afpstat1

grep 'afpd\[' /var/log/messages |
 awk '{match($5,/\[.*\]/);print substr($5,RSTART + 1, RLENGTH - 2), $0}' |
 sort -k 1 > /tmp/afpstat2

# now, join the results together by process id
join /tmp/afpstat1 /tmp/afpstat2

# get rid of the work files
rm /tmp/afpstat*
-------------------cut here-----------------

---
Jim Hart
"Organization is necessary for things to exist; Chaos is necessary for 
things to evolve."