Subject: Re: How to determine which Mac s are connected?
From: jhart@abacus.bates.edu
Date: Thu Mar 23 2000 - 11:32:37 EST
Patrik Schindler, poc@pocnet.net 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."-----BEGIN PGP PUBLIC KEY BLOCK----- Version: PGPfreeware 5.0 for non-commercial use <http://www.pgp.com>
mQBvAzOe/64AAAEDAM2s9O/EPXKlnvPOnJDH0f1KWg0iIM4i5tT7aywHcbW2Acgr b7aaTMe0eEMu+aSDjAto9+nYSHGOG/8ni/V7aW60W2zF1AQ8dPcyLZ9l1FaoWcr2 CP8uL2bZNGZvghpEdQARAQABtCBKaW0gSGFydCA8amhhcnRAbWFpbC5hdmNuZXQu b3JnPg== =ymPR -----END PGP PUBLIC KEY BLOCK-----
This archive was generated by hypermail 2b28 : Wed Jan 17 2001 - 14:30:17 EST