11
09/24
nginx日志按天分割
nginx日志按天分割,并自动邮件30天前的日志 #!/bin/bash log_files_path="/usr/local/nginx/logs/" log_files_dir=${log_files_path} nginx_sbin="/usr/local/nginx/sbin/nginx" save_days=30 mv ${log_files_path}access.log ${log_files_dir}access.log_$(date -d "yesterday" +"%Y-%m-%d") find $log_files_path -mtime +$save_days -exec rm -rf {} \; $nginx_sbin -s reload