一.脚本编写
#!bin/bash
data=$(date +%F-%H:%M)
mv /application/nginx/logs/access.log/application/nginx/logs/access.log.$data
/application/nginx/sbin/nginx -s reload
二.执行计划任务
# cron logs
0 0 * * * /bin/sh /server/scripts/log_cron.sh&>/dev/null
#!bin/bash
data=$(date +%F-%H:%M)
mv /application/nginx/logs/access.log/application/nginx/logs/access.log.$data
/application/nginx/sbin/nginx -s reload
# cron logs
0 0 * * * /bin/sh /server/scripts/log_cron.sh&>/dev/null
本文标题:【日志切割】
本文链接:https://www.haomeiwen.com/subject/jkvmectx.html
网友评论