I'm on a college campus and am using DAVE to interact with the non Mac users of the world. If I want to see who's on my server at any given time, all I need to do is a netstat, and it'll list all current connections. But I'm not always around to check on who's connected. So I wrote two scripts to do this for me. One script is run every 15 minutes and gets a list of currently connected computers and stores it to a file. The second script runs daily and takes the output of the first script, cleans it up a it, removes all duplicate listings, then stores it into a second file.
Read the rest of the article for the two scripts.
Script #1
#! /bin/shNOTE: Shown on two lines! Enter as one with no spaces between the '>>' and the '/Users'. Save this script and make it executable (chmod 755).
netstat | grep freyja-2.netbios-ssn | cut -c45-60 >>
/Users/jedediah/Library/Logs/minutesmblog.log
#! /bin/shNOTE: The 'cat' command is shown on two lines! Enter as one line only! Save this script and make it executable (chmod 755).
cat /Users/jedediah/Library/Logs/minutesmblog.log |
sed s/./ / | awk '{print $1}' | sort | uniq >>SMB_Access.log
rm -rf /Users/jedediah/Library/Logs/minutesmblog.log
Comments (0)
Mac OS X Hints
http://hints.macworld.com/article.php?story=20020220094006286