[root@server110 ~]# vim /data/shell/cut_varnish_log.sh #!/bin/sh logs_path=/data/varnish/logs vlog=${logs_path}/varnish.log date=$(date -d "yesterday" +"%Y-%m-%d") pkill -9 varnishncsa mkdir -p ${logs_path}/$(date -d "yesterday" +"%Y")/$(date -d"yesterday" +"%m")/ mv /data/varnish/logs/varnish.log ${logs_path}/$(date -d"yesterday" +"%Y")/$(date -d "yesterday"+"%m")/varnish-${date}.log /usr/local/varnish/bin/varnishncsa -w/data/varnish/logs/varnish.log & 使用计划任务,每天晚上凌晨00点运行日志切割脚本 echo "0 0 * * * /data/shell/cut_varnish_log.sh" >>/etc/crontab |
欢迎光临 360°网站管家_运维学院_提供最新最全的服务器运维视频教程与网站维护视频教程 (http://bbs.360wzgj.com/) | Powered by Discuz! X3.2 |