chenkehao 发表于 2018-12-26 12:26:16

squid的日志rotate问题

#!/bin/sh  
set -e
  
yesterday_secs=`perl -e 'print time -43200'`
  
yesterday_date=`date -r $yesterday_secs +%Y%m%d`
  
cd /usr/local/squid/var/logs
  
# rename the current log file without interrupting the logging process
  
mv access.log access.log.$yesterday_date
  
# tell Squid to close the current logs and open new ones
  
/usr/local/squid/sbin/squid -k rotate
  
# give Squid some time to finish writing swap.state files
  
sleep 60
  
mv access.log.$yesterday_date /archive/location/
  
gzip -9 /archive/location/access.log.$yesterday_date


页: [1]
查看完整版本: squid的日志rotate问题