#!/bin/bash
log_path=/CD/nginx/logs
cd $log_path
cur_date=` date +%Y%m%d`
sleep 60
sudo mv access.log $log_path/access.log.$cur_date
nginx_pid=`ps -ef |grep -v grep |grep "nginx: master process "|awk -F " " '{print $2}'`
echo $nginx_pid
`sudo kill -USR1 $nginx_pid`
find $log_path -type f -mtime +7 |xargs rm -rf