Nginx日志切割脚本

Nginx日志切割脚本

#!/bin/bash  
logs_path="/alidata/server/log/nginx/"    
mv ${logs_path}access.log ${logs_path}access_$(date -d "yesterday" +"%Y%m%d").log    
kill -USR1 `cat /alidata/server/nginx/logs/nginx.pid`

添加权限后加入crontab中:  
chmod +x /alidata/server/nginx/sbin/split_nginx_log.sh    
crontab -e    
0 1 * * * /alidata/server/nginx/sbin/split_nginx_log.sh    
crontab -l

你可能感兴趣的:(nginx,日志,日志切割,切割)