Created
November 15, 2015 06:17
-
-
Save CanadianJeff/f6403734e8400f94455b to your computer and use it in GitHub Desktop.
Clean cPanel Apache Logs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "Stopping HTTPD" | |
service httpd stop &>/dev/null | |
killall httpd &>/dev/null | |
rm -rf /tmp/sess_* | |
find /home/share -name 'error_log' -exec rm -rf {} \; | |
find /home/*/public_html -name 'error_log' -exec rm -rf {} \; | |
find /var/www/apache -name 'error_log' -exec rm -rf {} \; | |
#sed -i '/Execut/d' /usr/local/apache/logs/suphp_log | |
for ip in 192.168. 127.0.0.1 ::1; do | |
echo "Working On: $ip" | |
sed -i "/$ip/d" /usr/local/apache/logs/access_log | |
sed -i "/$ip/d" /usr/local/apache/logs/error_log | |
#sed -i "/$ip/d" /usr/local/apache/domlogs/*.me | |
sed -i "/$ip/d" /usr/local/apache/domlogs/*.com | |
sed -i "/$ip/d" /usr/local/apache/domlogs/*.ca | |
sed -i "/$ip/d" /usr/local/apache/domlogs/*.org | |
done | |
echo "Done" | |
sleep 3 | |
echo "Starting HTTPD" | |
service httpd restart &>/dev/null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment