projects
/
scripts
/
scripts.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
eadd953
)
use find to search for files +3M
author
hackbard
<hackbard>
Thu, 6 Oct 2005 20:50:40 +0000
(20:50 +0000)
committer
hackbard
<hackbard>
Thu, 6 Oct 2005 20:50:40 +0000
(20:50 +0000)
logrotate.sh
patch
|
blob
|
history
diff --git
a/logrotate.sh
b/logrotate.sh
index
9938c80
..
b97a9d8
100755
(executable)
--- a/
logrotate.sh
+++ b/
logrotate.sh
@@
-4,17
+4,13
@@
dodel=0
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
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
done
if [ "$dodel" = "1" ] ; then