4 # Trace one afpsrv client process by PID with srvmsg -D and truss
5 # and snoop AFP traffic with one client by IP
9 echo "Usage: trace.sh <folder for trace output> <PID of afpsrv client process> <IP of the AFP client>"
17 echo Tracing afpsrv process with PID $AFPPID and AFP client with IP $IP.
18 echo Writing trace data to $DIR.
20 if [ ! -d "${DIR}" ] ; then
24 exec >"${DIR}/trace.log" 2>&1
26 PATH=$PATH:/usr/local/helios/bin:/usr/local/helios/sbin
28 HELIOSDIR=`cat /etc/HELIOSInstallPath`
30 echo Collecting system data ... > /dev/tty
36 "${HELIOSDIR}/bin/swho" -cn
38 fuser "${HELIOSDIR}/lib/libhelios_s.so"
40 fuser "${HELIOSDIR}/var/run/locktable"
44 echo Starting traces... Now reproduce problem. Press RETURN to abort > /dev/tty
46 srvmsg -D $AFPPID -l all > "${DIR}/afp.srvmsg" &
49 truss -d -D -E -v all -o "${DIR}/afp.truss" -p $AFPPID &
52 snoop -o "${DIR}/snoop.pcap" host $IP and port 548 > /dev/null 2>&1 &
58 # Terminate tracing session
59 echo Killing traces... > /dev/tty
60 kill $PID_SRVMSG_AFP $PID_TRUSS_AFP $PID_SNOOP
62 echo Creating tar archive of folder \"$DIR\" as \"$DIR.tar\" ...
63 tar cf "$DIR.tar" "$DIR"