On Sun 15 May 2005, Michelle Konzack wrote:
> 
> I like to see savelog creating logs like
> 
>     logfile
>     logfile.20050515
>     logfile.20050508.gz
>     logfile.20050501.gz

Something like this is possible with the -d option, which exists from at
least the 2.1.1 version of debianutils (changelog mentions documenting
it), it probably existed earlier.

The extension is then YYYYmmddHHMMSS instead of 0, 1, 2, ...

There's just one problem: the first savelog invocation prints out an
error:

$ rm foo*
rm: cannot remove `foo*': No such file or directory
$ touch foo
$ savelog -d foo
gzip: 
.//foo.[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]: 
No such file or directory
Rotated `foo' at Tue Oct 16 15:04:58 CEST 2007.

A tentative fix for this is included below.


Paul Slootman

--- savelog.orig        2007-09-30 15:30:35.000000000 +0200
+++ savelog     2007-10-16 15:23:34.717094816 +0200
@@ -262,7 +262,11 @@
 
        # compress the old uncompressed log if needed
        if test -n "$datum" && test -n "$COMPRESS"; then
-               $COMPRESS $COMPRESS_OPTS -- 
"$newname".[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]
+                # test whether there are in fact any old uncompressed logs,
+                # to prevent gzip error
+                if [ "$(echo 
"$newname".[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9])"
 != 
"$newname.[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]"
 ]; then
+                    $COMPRESS $COMPRESS_OPTS -- 
"$newname".[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]
+                fi
        fi
 
        # remove old files if so desired



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to