How To Reduce Log File Disk Usage With ISPConfig Or LAMP
Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
How To Reduce Log File Disk Usage With ISPConfig Or LAMPSlowly I was seeing my disk usage increasing, I knew it was log files that were getting bigger and bigger. I found out that Apache log files were the worst, there was around 1GB of space used in 3 months. So I decided to make a bash script that would compress Apache log file every month. I run ISPConfig, the script can be modified to your needs : #!/bin/bash
MONTH="$((`date +%m`-1))"
YEAR=$(date +"%Y")
cd /var/www/
for f in $(ls /var/www | grep web); do
cd /var/www/$f/log
if [ -a $YEAR ];
then
cd $YEAR
if [ -a 0$MONTH ];
then
tar -zcvf 0$MONTH.tar.gz 0$MONTH
rm -rf /var/www/$f/log/$YEAR/0$MONTH
fi
fi
done
Then you run this script in your crontab the first day of each month: 05 03 1 * * sh /root/logclean.sh
|
Sponsored Links:
Turn your desk phone and mobile phone into one with Sprint Mobile Integration.
www.seamlessenterprise.com
One number. One voicemail. Seize the lead. Sprint Mobile Integration.
www.seamlessenterprise.com
One Number. One Voicemail.
Make it easier for clients to reach you. Turn your desk phone and mobile phone into one with Sprint Mobile Integration.
www.seamlessenterprise.com
One number. One voicemail. Sprint Mobile Integration.
www.seamlessenterprise.com
AT&T Synaptic Compute as a Service. Boost your power on demand.
Trial: IBM Cognos Express Reporting, Analysis & Planning
www.seamlessenterprise.com
One number. One voicemail. Seize the lead. Sprint Mobile Integration.
www.seamlessenterprise.com
One Number. One Voicemail.
Make it easier for clients to reach you. Turn your desk phone and mobile phone into one with Sprint Mobile Integration.
www.seamlessenterprise.com
One number. One voicemail. Sprint Mobile Integration.
www.seamlessenterprise.com
AT&T Synaptic Compute as a Service. Boost your power on demand.
Trial: IBM Cognos Express Reporting, Analysis & Planning







Recent comments
15 hours 1 min ago
17 hours 2 min ago
20 hours 14 min ago
22 hours 33 min ago
23 hours 43 min ago
1 day 1 hour ago
1 day 5 hours ago
1 day 8 hours ago
1 day 8 hours ago
1 day 23 hours ago