Nginx日志的切割和整理命令

cd  /usr/local/nginx/logs/
mv sendsadmin.access.log sendsadmin.access.$(date +%Y%m%d).log   
mv error.log error.$(date +%Y%m%d).log   
sudo kill -USR1 `cat /usr/local/web/nginx762/logs/nginx.pid`   
find /var/log/nginx/ -name "sendsadmin.access.*" -type f -mtime +30 -exec rm {} \; > /dev/null 2>&1   
find /var/log/nginx/ -name "error.*" -type f -mtime +30 -exec rm {} \; > /dev/null 2>&1   

#!/bin/sh  
cd /var/log/nginx/  
mv sendsadmin.access.log sendsadmin.access.$(date +%Y%m%d).log  
mv error.log error.$(date +%Y%m%d).log  
sudo kill -USR1 `cat /usr/local/web/nginx762/logs/nginx.pid`  
find /var/log/nginx/ -name "sendsadmin.access.*" -type f -mtime +30 -exec rm {} \; > /dev/null 2>&1  
find /var/log/nginx/ -name "error.*" -type f -mtime +30 -exec rm {} \; > /dev/null 2>&1 

 

 

你可能感兴趣的:(nginx)