nginx日志切割
nginx日志切割
#!/bin/bash ######################################################################### # File Name: ng_log.sh # Created on: 2019-11-08 16:30:46 # Author: xieys # Last Modified: 2019-11-08 16:30:46 # Description: # nginx日志分割 ######################################################################### LANG=en_US.UTF-8 BASEDIR="/usr/local/nginx/logs/access/access_" BASEFILE="/usr/local/nginx/logs/access/access.log" log_file=${BASEDIR}`date -d "-1 day" +"%Y_%m_%d"`".log" month=`date -d "-1 day" +"%b"` day=`date -d "-1 day" +"%d"` year=`date -d "-1 day" +"%Y"` mv $BASEFILE $log_file /usr/bin/kill -USR1 `ps -ef | grep -v " grep"|grep nginx | awk '/master/ {print $2}'` LANG=zh_CN.UTF-8
浙公网安备 33010602011771号