清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
#!/bin/bash Logs_path="/data/Application/nginx/logs" Pid_path="/data/Application/nginx/nginx.pid" Month=`date +%Y-%m` Date=`date +%Y-%m-%d` Time=`date +%H` WaitTime=$((24*60*60)) LogCut() { cd $Logs_path mkdir -p $Month while true do mv $Logs_path/access.log $Logs_path/$Month/access_$Date.log kill -USR1 `cat ${Pid_path}` done sleep $WaitTime return 0 } case $1 in start) LogCut >/dev/null & ;; stop) kill -9 `ps aux | grep LogCut | grep -v grep | awk '{print $2}'`>/dev/null ;; restart) kill -9 `ps aux | grep LogCut | grep -v grep | awk '{print $2}'`>/dev/null LogCut >/dev/null & ;; *) echo "Usage ERROR!Please use "start" or "stop" or "restart"!" esac