OS/Shell Script
apache accesslog 삭제
태하팍
2018. 4. 24. 18:32
반응형
주저리
디스크가 Full이 났다.
보니 아파치 액세스로그가 엄청나게 쌓이고 있었다..
매번 쌓일때마다 지워줘야하니 짜증이-_-;;
그래서 찾아보았다. 아파치 httpd.conf에서 옵션으로 삭제가 가능한지를..
잘못찾겠다-_-; 그래서 그냥 쉘스크립트로 삭제를 하기로 맘먹었다.
쉘 스크립트로 처리
remove_apache_accesslog.sh라는 쉘을 하나 만들었다.
shell의 내용
#!/bin/bash # older than 1 days(수정 시간: mtime) find -daystart -type f -name "*.access_log" -mtime +1 -delete |
-daystart 옵션이 중요하다.
참고 사이트 : https://www.gnu.org/software/findutils/manual/html_node/find_html/Age-Ranges.html
크론탭 스케줄링 처리
크론탭 설정 (crontab -e)
# 아파치 액세스로그 삭제 0 1 * * * /acet/script/remove_apache_accesslog.sh >> /acet/script/remove.log 2>&1 |
반응형