Nginx 로그 절단 및 정리 명령

973 단어 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 

 

좋은 웹페이지 즐겨찾기