... instead of 01, 02, ...
-$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.55 2004/12/21 14:38:02 ph10 Exp $
+$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.56 2004/12/21 16:26:31 ph10 Exp $
Change log file for Exim from version 4.21
-------------------------------------------
Change log file for Exim from version 4.21
-------------------------------------------
57. Double the size of the debug message buffer (to 2048) so that more of very
long debug lines gets shown.
57. Double the size of the debug message buffer (to 2048) so that more of very
long debug lines gets shown.
+58. The exicyclog utility now does better if the number of log files to keep
+ exceeds 99. In this case, it numbers them 001, 002 ... instead of 01, 02...
+
Exim version 4.43
-----------------
Exim version 4.43
-----------------
-# $Cambridge: exim/src/src/exicyclog.src,v 1.1 2004/10/07 10:39:01 ph10 Exp $
+# $Cambridge: exim/src/src/exicyclog.src,v 1.2 2004/12/21 16:26:31 ph10 Exp $
# Copyright (c) 2004 University of Cambridge.
# See the file NOTICE for conditions of use and distribution.
# Copyright (c) 2004 University of Cambridge.
# See the file NOTICE for conditions of use and distribution.
# This is a shell script for cycling exim main and reject log files. Each time
# it is run, the files get "shuffled down" by one, the current one (e.g.
# mainlog) becoming mainlog.01, the previous mainlog.01 becoming mainlog.02,
# This is a shell script for cycling exim main and reject log files. Each time
# it is run, the files get "shuffled down" by one, the current one (e.g.
# mainlog) becoming mainlog.01, the previous mainlog.01 becoming mainlog.02,
-# and so on, up to the limit configured here. The same happens to the reject
-# logs. All those with numbers greater than 1 are compressed.
+# and so on, up to the limit configured here. When the number to keep is
+# greater than 99 (not common, but some people do it), three digits are used
+# (e.g. mainlog.001). The same shuffling happens to the reject logs. All
+# renamed files with numbers greater than 1 are compressed.
# This script should be called regularly (e.g. daily) by a root crontab
# entry of the form
# This script should be called regularly (e.g. daily) by a root crontab
# entry of the form
# When the number is less than 10, insert a leading zero.
count=$keep
# When the number is less than 10, insert a leading zero.
count=$keep
-if [ $count -lt 10 ]; then countt=0$count; else countt=$count; fi;
+if [ $count -lt 10 ]; then countt=0$count; else countt=$count; fi
while [ $count -gt 1 ]; do
old=`expr $count - 1`
while [ $count -gt 1 ]; do
old=`expr $count - 1`
- if [ $old -lt 10 ]; then oldt=0$old; else oldt=$old; fi;
+ if [ $keep -gt 99 ]; then
+ if [ $old -lt 10 ]; then oldt=00$old
+ elif [ $old -lt 100 ]; then oldt=0$old
+ else oldt=$old
+ fi
+ else
+ if [ $old -lt 10 ]; then oldt=0$old; else oldt=$old; fi;
+ fi
if [ -f $mainlog.$oldt ]; then
$mv $mainlog.$oldt $mainlog.$countt
elif [ -f $mainlog.$oldt.$suffix ]; then
if [ -f $mainlog.$oldt ]; then
$mv $mainlog.$oldt $mainlog.$countt
elif [ -f $mainlog.$oldt.$suffix ]; then
-# Now rename the current files as 01
+# Now rename the current files as 01 or 001 if keeping more than 99
+
+if [ $keep -gt 99 ]; then first=001; else first=01; fi
- $mv $mainlog $mainlog.01
- $chown $user:$group $mainlog.01
+ $mv $mainlog $mainlog.$first
+ $chown $user:$group $mainlog.$first
fi
if [ -f $rejectlog ]; then
fi
if [ -f $rejectlog ]; then
- $mv $rejectlog $rejectlog.01
- $chown $user:$group $rejectlog.01
+ $mv $rejectlog $rejectlog.$first
+ $chown $user:$group $rejectlog.$first
-# Now scan the 02 and later files, compressing where necessary, and
+# Now scan the (0)02 and later files, compressing where necessary, and
# ensuring that their owners and groups are correct.
count=2;
while [ $count -le $keep ]; do
# ensuring that their owners and groups are correct.
count=2;
while [ $count -le $keep ]; do
- if [ $count -lt 10 ]; then countt=0$count; else countt=$count; fi
+ if [ $keep -gt 99 ]; then
+ if [ $count -lt 10 ]; then countt=00$count
+ elif [ $count -lt 100 ]; then countt=0$count
+ else countt=$count
+ fi
+ else
+ if [ $count -lt 10 ]; then countt=0$count; else countt=$count; fi
+ fi
if [ -f $mainlog.$countt ]; then $compress $mainlog.$countt; fi
if [ -f $mainlog.$countt.$suffix ]; then
$chown $user:$group $mainlog.$countt.$suffix
if [ -f $mainlog.$countt ]; then $compress $mainlog.$countt; fi
if [ -f $mainlog.$countt.$suffix ]; then
$chown $user:$group $mainlog.$countt.$suffix