vi /home/logs/nginx_log.sh
#!/bin/bash
logs_path="/home/logs/"
pid_path="/run/nginx.pid"
mv ${logs_path}access.log ${logs_path}access_$(date -d "yesterday" +"%Y%m%d").log
mv ${logs_path}error.log ${logs_path}error_$(date -d "yesterday" +"%Y%m%d").log
kill -USR1 `cat ${pid_path}`
crontab -e
0 0 * * * /bin/bash /home/logs/nginx_log.sh > /dev/null &
星期四, 08/27/2020 - 17:23 — 杨超