NGINX 多域名日志切割备份脚本
#!/bin/bash# Info : cut logs for nginx# Author : elain# CTime : 2011.06.08# This script run at 00:00# The Nginx logs pathLogs_Path=”/elain/logs/nginx”log_filenames=`/bin/ls $Logs_Path |grep -v nginx|grep -v logsbak`for log_name in $log_filenamesdo/bin/mv $Logs_Path/$log_name $Logs_Path/logsbak/`date -d yesterday +%Y%m%d%H%M`-$log_namedonekill -USR1 `cat /elain/apps/nginx/nginx.pid`
# Info : 每天凌晨0点切割一次NGINX日志# Author : elain# CTime : 2011.06.0800 00 * * * /root/scripts/cut_nginx_log.sh