[comp.unix.xenix] uulog traffic summary

ron@mlfarm.UUCP (Ronald Florence) (09/22/89)

After switching over to HoneyDanBer uucp, I missed the traffic
summary available with the "uusub -r" command in the pre-HDB uucp.
The following patch to /usr/bin/uulog adds a "-t" option which will
produce a traffic summary in the format:

     Sep 16 21:04 to Sep 22 09:44
     system    rfiles    rbytes    sfiles    sbytes    
     hsi       122       1717652   14        15308     
     bwp       2         1536      22        192307    
     rayssd    0         0         2         1120      
     aati      16        22691     2         1951      
     purvid    12        3418      21        319443    

_______________________________________________
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create:
#	uulog.patch
# This archive created: Fri Sep 22 09:38:50 1989
# By:	Ronald Florence (Maple Lawn Farm, Stonington, CT)
export PATH; PATH=/bin:/usr/bin:$PATH
echo shar: "extracting 'uulog.patch'" '(751 characters)'
if test -f 'uulog.patch'
then
	echo shar: "will not over-write existing file 'uulog.patch'"
else
sed 's/^X//' << \SHAR_EOF > 'uulog.patch'
X21a22,23
X> # ron@mlfarm, 8/26/89, added -t option for traffic
X> #
X22a25,46
X> traffic()
X> {
X>   Spool=/usr/spool/uucp
X>   Stats=$Spool/.Admin/xferstats
X>   Oldstats=$Spool/.Old/xferstats
X> 
X>   echo "`l $Oldstats | cut -c42-53` to `date '+%h %d %H:%M'`"
X>   awk < $Stats  '
X>   {
X>     split($1, a, "!")
X>     sys = a[1]
X>     systems[sys]++
X>     if ($6 == "<-")  { rfiles[sys]++; rbytes[sys] += $7 }
X>     else { sfiles[sys]++; sbytes[sys] += $7 }
X>   }
X>   END {
X>     printf "%-10s%-10s%-10s%-10s%-10s\n", "system", "rfiles", "rbytes", "sfiles", "sbytes"
X>     for (name in systems) 
X>       printf "%-10s%-10d%-10d%-10d%-10d\n", name, rfiles[name], rbytes[name], sfiles[name], sbytes[name]
X>   }'
X> }
X> 
X31a56,59
X> 	-t)	traffic
X> 		exit
X> 		;;
X> 
SHAR_EOF
if test 751 -ne "`wc -c < 'uulog.patch'`"
then
	echo shar: "error transmitting 'uulog.patch'" '(should have been 751 characters)'
fi
fi
exit 0
#	End of shell archive
-- 

Ronald Florence			...{hsi,rayssd}!mlfarm!ron