double 'ctlinnd flushlogs' deletes news, errlog

Florian Schlichting fschlich at cis.fu-berlin.de
Tue Apr 16 14:22:21 UTC 2013


John,

> I would prefer the addition to the filename be the ISO 8601 date and time.

we use the following local patch to add the number of the day, but of
course you can easily change the format parameter of the date call
(there may be some fuzz, but you'll get the idea):

--- a/scripts/scanlogs.in
+++ b/scripts/scanlogs.in
@@ -303,30 +275,10 @@ if [ -s ${OLD_SYSLOG} -o -s ${OLD_LOG} ] ; then
 ##  Compress and rotate the logs.
 if ${ROTATE} ; then
     cd ${OLD}
-    if [ X${LOGCYCLES} = X ]; then
-        LOGCYCLES=3
-    fi
     for F in ${LOGS} ; do
-       ##  Skip if it's unwanted.log, since it's already rotated.
-       if [ ${F} = ${UNWANTED_LOG} ]; then
-           continue
-       fi
        ##  Skip if file doesn't exist.
        BASE=`basename ${F}`
        test -f ${BASE} || continue
@@ -325,16 +277,8 @@ if ${ROTATE} ; then
        ${LOG_COMPRESS} <${BASE} >${BASE}.0${Z} && rm -f ${BASE}
        chmod 0440 ${BASE}.0${Z}

-       ##  Do rotation.
-       EXT=${LOGCYCLES}
-       rm -f ${BASE}.${LOGCYCLES}${Z}
-       while [ ${EXT} -gt 0 ] ; do
-           NEXT=${EXT}
-           EXT=`expr ${EXT} - 1`
-           test -f ${BASE}.${EXT}${Z} \
-               && rm -f ${BASE}.${NEXT}${Z} \
-               && mv ${BASE}.${EXT}${Z} ${BASE}.${NEXT}${Z}
-       done
+       ##  Move the file once instead of daily rotation.
+       mv -f ${BASE}.0${Z} ${BASE}.`date +%d`${Z}
     done

     ##  Remove lock.

I felt properly supporting that in a configurable manner in scanlogs
along with the old behaviour is too cumbersome; allowing to switch log
rotation components e.g. to logrotate or something built into the file
system is likely a better way to spend one's time.

Florian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 5565 bytes
Desc: not available
URL: <https://lists.isc.org/pipermail/inn-workers/attachments/20130416/bf33599f/attachment.bin>


More information about the inn-workers mailing list