Annotation of scripts/ipcad-to-squid.sh, Revision 1.1.1.1
1.1 kirby 1: #!/bin/sh
2:
3: # Interface variables for grepping
4:
5: RSH="/usr/bin/rsh"
6: GREP="/usr/bin/grep"
7: AWK="/usr/bin/awk"
8: SQUID_LOG="/var/log/squid/access.log"
9: SQUID_EXT_LOG="/var/log/squid/access_external.log"
10:
11: local_if="re0"
12: isp1_if="xl0"
13: isp2_if="eth1"
14: isp3_if="eth3"
15:
16: # grep time in Epoch format
17: ttime=`$RSH 127.0.0.1 show ip accounting | $GREP "Accounting data saved" | $AWK '{print ($4)}'`
18:
19: # Move accounting to checkpoint
20: $RSH 127.0.0.1 clear ip accounting >> /dev/null
21:
22: # Read accounting from checkpoint for local_if
23: $RSH 127.0.0.1 show ip accounting checkpoint | $GREP $local_if | $AWK -v vtime=$ttime '{print (vtime".000",1,$2,"TCP_MISS/200",$4,"CONNECT",$1":"$5,"-","DIRECT/"$1,"-")}' >> $SQUID_LOG
24:
25: # Read accounting from checkpoint for isp1_if
26: $RSH 127.0.0.1 show ip accounting checkpoint | $GREP $isp1_if | $AWK -v vtime=$ttime '{print (vtime".000",1,$2,"TCP_MISS/200",$4,"CONNECT",$1":"$5,"-","DIRECT/"$1,"-")}' >> $SQUID_EXT_LOG
27:
28: # Read accounting from checkpoint for isp2_if
29: #$RSH 127.0.0.1 show ip accounting checkpoint | $GREP $isp2_if | $AWK -v vtime=$ttime '{print (vtime".000",1,$2,"TCP_MISS/200",$4,"CONNECT",$1":"$5,"-","DIRECT/"$1,"-")}' >> $SQUID_EXT_LOG
30:
31: # Read accounting from checkpoint for isp3_if
32: #$RSH 127.0.0.1 show ip accounting checkpoint | $GREP $isp3_if | $AWK -v vtime=$ttime '{print (vtime".000",1,$2,"TCP_MISS/200",$4,"CONNECT",$1":"$5,"-","DIRECT/"$1,"-")}' >> $SQUID_EXT_LOG
CVSweb