nginx日志自动每日切割脚本
1、脚本内容
#!/bin/bash #日志文件存放目录 logs_path="/var/log/nginx/e/" # pid文件 pid_path="/run/nginx.pid" #重命名日志文件 mv ${logs_path}access.log ${logs_path}access_$(date -d "yesterday" +"%Y%m%d").log #向nginx主进程发送信号以重新打开日志 kill -USR1 `cat ${pid_path}`
2、Crontab任务配置
0 0 * sh /home/ubuntu/www/Pikachu/shell/cutAccessLogs.sh
相关推荐
nginxs 2020-11-14
Guanjs0 2020-11-13
小木兮子 2020-11-11
yserver 2020-11-11
ssihc0 2020-11-11
windle 2020-11-10
HanksWang 2020-11-10
liuchen0 2020-11-10
Freshairx 2020-11-10
ccschan 2020-11-10
liwf 2020-11-10
Guanjs0 2020-11-09
AderStep 2020-11-09
zrtlin 2020-11-09
mqfcu 2020-11-10
windle 2020-10-29