DateFormat=`date +%Y%m%d`
BaseDir="/application/nginx"
NginxLog="$BaseDir/logs"
LogName="access.log"
[ -d $NginxLog ] && cd $NginxLog || exit 1
[ -f $LogName ] || exit 1
/bin/mv $LogName ${DateFormat}_${LogName}
$BaseDir/sbin/nginx -s reload
本文转自chenzudao51CTO博客,原文链接:http://blog.51cto.com/victor2016/1886050 ,如需转载请自行联系原作者