nginx日志分割脚本
/shell/nginx-log-split.sh
#!/bin/bash
base_path='/home/wwwlogs' log_path=$(date -d yesterday +"%Y%m") day=$(date -d yesterday +"%d") mkdir -p $base_path/$log_path mv $base_path/access.log $base_path/$log_path/access_$day.log kill -USR1 `cat /usr/local/nginx/logs/nginx.pid`每5s执行脚本
/shell/execution-per-5s.sh
#!/bin/bash
step=5 #间隔的秒数,不能大于60 for (( i = 0; i < 60; i=(i+step))); do $(php '/home/wwwroot/default/running/Public/crontab.php') sleep $step done exit 0