dodel=0
-for i in /var/log/messages /var/log/sys.log /var/opt/apache2/logs/access_log /var/opt/apache2/logs/error_log; do
- if [ -f $i ] ; then
- mess_size=`du -h $i | awk '{ print $1 }' | sed 's/.*k/0/' | awk -F. '{ print $1 }'`
- if [ "$mess_size" -gt "3" ] ; then
+logpaths="/var/log /var/opt/apache2/logs"
+for i in `find $logpaths -size +3M`; do
rm -f ${i}.bz2
bzip2 $i
echo "rotated $i file, touching empty file."
[ ! -f $i ] && touch $i
dodel=1
- fi
- fi
done
if [ "$dodel" = "1" ] ; then