nginx 按日期分割access.log日志
作者:
果酱一一 | 来源:发表于
2015-12-27 17:28 被阅读2339次nginx 按日期分割access.log日志
#nginx日志切割脚本
#author: http://www.nginx.cn
#!/bin/bash
#设置日志文件存放目录
logs_path="/home/wwwlogs/"
#设置pid文件
pid_path="/usr/local/nginx/logs/nginx.pid"
#重命名日志文件
mv ${logs_path}access.log ${logs_path}access_$(date -d "yesterday" +"%Y%m%d").log
#向nginx主进程发信号重新打开日志
kill -USR1 `cat ${pid_path}`
# crontab 配置 0 0 * * * /bin/bash /home/wwwlogs/nginx_log.sh
service crond restart
参考url:
http://www.yetyun.com/home/linux/99.html
本文标题:nginx 按日期分割access.log日志
本文链接:https://www.haomeiwen.com/subject/iaybhttx.html
网友评论