[root@test ~]# more nginx-log.sh 

#!/bin/bash

log_dir=/var/log/nginx

date=`date +%Y%m%d%H`


logrotate -vf /etc/logrotate.d/nginx


mv ${log_dir}/access.log.1.gz ${log_dir}/access.log-$date.gz

mv ${log_dir}/error.log.1.gz ${log_dir}/error.log-$date.gz

[root@test ~]#