proxy代理   soft软件   IT 业界特快   norton 诺顿病毒库   代理列表   search FTP搜索   whois IP地理位置   blog 追求完美  
money理财   life生活   RSS聚合门户   firefox WEB浏览器   免费域名   typeset 假古文   AntiVirus 反病毒   ipcn 站点导航  

« lftp - my fav & some mirror method - ncftp wget rsync | Main | ntpdate time synchronization & date usage »

April 28, 2004

squid cache_peer access log analysis crontab demo

版权声明:可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息及本声明。
https://windtear.net/archives/2004/04/28/000298.html

# proxy
59 23 * * * /opt/old_access/squid-log.sh.new.sh
0 0 * * * /opt/old_access/cron.squid.autodeny.sh
5 0 * * * /opt/old_access/squid-log.sh.new.sh.step2.sh

# proxy2
59 23 * * * /opt/old_access/squid-log.sh.new.sh
0 0 * * * /opt/old_access/cron.squid.autodeny.sh


# proxy
----->  /opt/old_access/squid-log.sh.new.sh
NOW_DATE=$(date +%Y%m%d)
killall tail
/opt/old_access/generate.currentdeny.squid.from.iptables.sh
/sbin/iptables -F squid
/bin/mv -f $OLD_ACCESS/access.log $OLD_ACCESS/access.log.bak
/usr/sbin/squid -k rotate


# proxy
----->  /opt/old_access/squid-log.sh.new.sh.step2.sh
NOW_DATE=$(date --date=yesterday +%Y%m%d)
cd $OLD_ACCESS
wget http://proxy2/_old_log_/access.log.bak.$NOW_DATE.gz
[[ -f $OLD_ACCESS/access.log.bak.$NOW_DATE.gz ]] && zcat access.log.bak.$NOW_DATE.gz >> access.log.bak && rm -f access.log.bak.$NOW_DATE.gz
/opt/old_access/pwebstats -c /opt/old_access/squid-proxy.conf
/bin/mv -f $OLD_ACCESS/access.log.bak $OLD_ACCESS/access.log.bak.$NOW_DATE
/bin/gzip $OLD_ACCESS/access.log.bak.$NOW_DATE

# proxy
# proxy2
----->  /opt/old_access/cron.squid.autodeny.sh 
DATE=$(date +%Y%m%d)
cd /opt/old_access
mv squid.deny _old_deny_/squid.deny.$DATE
mv squid.deny.log _old_deny_/squid.deny.log.$DATE
tail -f /opt/old_access/access.log | /opt/old_access/autodeny.pl


# proxy2
----->  /opt/old_access/squid-log.sh.new.sh
NOW_DATE=$(date +%Y%m%d)
killall tail
/sbin/iptables -F squid
/bin/mv -f $OLD_ACCESS/access.log $OLD_ACCESS/_old_log_/access.log.bak.$NOW_DATE
/usr/sbin/squid -k rotate
gzip $OLD_ACCESS/_old_log_/access.log.bak.$NOW_DATE 

本blog WWW

Posted by windtear at April 28, 2004 12:59 AM

本站使用中的任何问题,请与 windtear @ windtear.net 联系
Copyright© 1999-2024 Windtear. All rights reserved.