vim /opt/rizhi.sh
#!/bin/bash
ogs_path="/usr/local/nginx/logs/"
pid_path="/usr/local/nginx/logs/nginx.pid"
mv ${logs_path}access.log ${logspath}access$(date -d "yesterday" +"%Y%m%d").log
kill -USR1 cat ${pid_path}
脚本注释
1、编写脚本
2、查看日志文件
3、运行脚本并查看
转载于:https://blog.51cto.com/13760226/2160104