首页 > 其他 > 详细

nginx日志轮巡切割

时间:2017-01-01 19:54:59      阅读:234      评论:0      收藏:0      [点我收藏+]

通过编辑脚本的方式来实现日志每日以及每天的切割纪录。可以通过计划任务的方式实现每天执行脚本,具体情况需要更加实际情况

vim /root/cut_nginx_log.sh

#!bin/sh

Dateformat=‘date +%Y%m%d‘

Basedir="/application/nginx"

Nginxlogdir="$Basedir/logs"

Logname="access_www"

[ -d $Nginxlogdir ]&& cd $Nginxlogdir||exit 1

[ -f ${Logname}.log ]||exit 1

/bin/mv ${Logname}.log ${Dateformat}_${Logname}.log

$Basedir/sbin/nginx -s reload

nginx日志轮巡切割

原文:http://www.cnblogs.com/dianzixiaoming/p/6241346.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!