日志切割脚本:
[root@lb-nginx logs]# cat /data/scripts/cutnginxlog.sh
#!/bin/sh
#Dateformat=date +%Y%m%d
Dateformat=$(date +%F)
Basedir="/aliyun/nginx"
Nginxlogdir="$Basedir/logs"
Logname="access.log"
[ -d $Nginxlogdir ] && cd $Nginxlogdir||exit 1
[ -f ${Logname} ]||exit 1
/bin/mv ${Logname} ${Dateformat}
$Logname
$Basedir/sbin/nginx -s reload
#del 5 days ago logs
find $Basedir/logs/ -type f -name "*_access.Log" -mtime +5|xargs rm -f

写入定时任务:
[root@lb-nginx logs]# crontab -l
######cut ngx_access.logs####by wujianwei 2016-5-18
00 00 * /bin/sh /data/scripts/cut_nginxlog.sh &>/dev/null