Welcome to Elvin's blog

nginx日志切割

nginx日志切割

 

#!/bin/sh
#nginx日志切割

#设置
Log_path=/www/server/nginx/logs
Yesterday=$(date -d "yesterday" +%Y-%m-%d_%S)
Nginxbin=/www/server/nginx/sbin/nginx

#日志改名
/bin/mv $Log_path/access.log $Log_path/access.$Yesterday.log
/bin/mv $Log_path/error.log  $Log_path/error.$Yesterday.log

#重新生成日志
$Nginxbin -s reopen

# #定时任务
# #nginx日志切割
# 00 00 * * *  /root/sh/cut_log.sh
# #

 

posted @ 2017-11-02 22:32  blog-elvin-vip  阅读(219)  评论(0编辑  收藏  举报