提交 849ffe96 authored 作者: chenshiying's avatar chenshiying

[新增] 配置修改

上级 c1fe85cb
#!/bin/bash
#此脚本用于添加定时任务
chattr -ia /var/spool/cron
crontab /home/soft/logs/nginx/handle_nginx_log.conf
chattr +ia /var/spool/cron
\ No newline at end of file
#!/bin/bash
#此脚本用于自动分割Nginx的日志,包括access.log和error.log
#每天00:00执行此脚本 将前一天的access.log重命名为access-xxxx-xx-xx.log格式,并重新打开日志文件
#Nginx日志文件所在目录
LOG_PATH=/home/soft/logs/nginx
mkdir -p $LOG_PATH/data
#获取昨天的日期
YESTERDAY=$(date -d "yesterday" +%Y-%m-%d)
#获取pid文件路径
PID=/usr/local/nginx/logs/nginx.pid
#分割日志
fileList=`find $LOG_PATH -name "*.log"`
for file in $fileList
do
filename=${file##*/}
mv $file ${LOG_PATH}/data/${filename%.*}-${YESTERDAY}.log
done
#向Nginx主进程发送USR1信号,重新打开日志文件
kill -USR1 `cat ${PID}`
\ No newline at end of file
0 0 * * * /bin/bash /home/soft/logs/nginx/cut_nginx_log.sh
0 1 * * * /bin/bash /home/soft/logs/nginx/rm_nginx_log.sh
#!/bin/bash
#此脚本用于删除5天前的nginx日志,每天00:00执行此脚本
#Nginx日志文件所在目录
LOG_PATH=/home/soft/logs/nginx/data/
find ${LOG_PATH} -mtime +5 -name "*.log" -exec rm -rf {} \;
\ No newline at end of file
政务网
10.0.120.162 root
10.0.120.221 root
10.0.120.103 root
10.0.120.61 root
10.0.120.124 root
10.0.120.151 root
10.0.120.248 root
10.0.120.154 root
10.0.120.89 root
10.0.120.122 root
10.0.120.147 root
10.0.120.250 root
10.0.120.18 root
10.0.120.199 root
10.0.120.192 root
10.0.120.245 root
10.0.120.58 root
10.0.120.187 root
10.0.120.36 root
10.0.120.92 root
10.0.120.130 root
10.0.120.21 root
10.0.120.127 root
10.0.120.53 root
10.0.120.242 root
10.0.120.68 root
10.0.120.225 root
10.0.120.69 root
10.0.120.116 root
10.0.120.212 root
10.0.120.143 root
10.0.120.44 root
10.0.120.26 root
10.0.120.134 root
10.0.120.184 root
10.0.120.195 root
10.0.120.16 root
10.0.120.132 root
10.0.120.35 root
10.0.120.238 root
10.0.120.104 root
10.0.120.3 root
10.0.120.247 root
10.0.120.153 root
10.0.120.152 root
10.0.120.37 root
10.0.120.128 root
10.0.120.135 root
10.0.120.190 root
10.0.120.241 root
10.0.120.88 root
10.0.120.41 root
10.0.120.211 root
10.0.120.121 root
10.0.120.217 root
10.0.120.172 root
10.0.120.51 root
互联网
192.168.188.12
192.168.188.13
192.168.188.14
192.168.188.15
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论