severity #877148 wishlist
tags #877148 upstream

On Fri, Sep 29, 2017 at 07:46:51AM +0000, Roberto Suarez Soto wrote:
> currently the number of log files preserved in /var/log/atop is 28, hardcoded
> in atop.daily. There should be a way to change this number, so we could keep
> more or less files.

Can you try this patch for atop.daily? if it works, I'll submit this
upstream.

diff --git a/atop.daily b/atop.daily
index 32a94d8..8afb485 100755
--- a/atop.daily
+++ b/atop.daily
@@ -4,7 +4,8 @@ CURDAY=`date +%Y%m%d`
 LOGPATH=/var/log/atop
 BINPATH=/usr/bin
 PIDFILE=/var/run/atop.pid
-INTERVAL=600                           # interval 10 minutes
+INTERVAL=${INTERVAL:-600}                      # interval 10 minutes
+DAYS=${DAYS:-28}

 # verify if atop still runs for daily logging
 #
@@ -33,7 +34,7 @@ fi
 # start a child shell that activates another child shell in
 # the background to avoid a zombie
 #
-( (sleep 3; find $LOGPATH -name 'atop_*' -mtime +28 -exec rm {} \;)& )
+( (sleep 3; find $LOGPATH -name 'atop_*' -mtime +$DAYS -exec rm {} \;)& )

 # activate atop with interval of 10 minutes, replacing the current shell
 #

This will allow you to override INTERVAL and DAYS from the environment,
so you can put the desired value in your crontab.

Greetings
Marc

-- 
-----------------------------------------------------------------------------
Marc Haber         | "I don't trust Computers. They | Mailadresse im Header
Leimen, Germany    |  lose things."    Winona Ryder | Fon: *49 6224 1600402
Nordisch by Nature |  How to make an American Quilt | Fax: *49 6224 1600421

Reply via email to