🔒 Repository is read-only – file editing is disabled.
123456789101112131415161718192021222324252627282930313233343536373839
From a88a54107142d057e36be15285c972031a0e8c0a Mon Sep 17 00:00:00 2001
From: Marc Haber <mh+mr-git@zugschlus.de>
Date: Tue, 24 Apr 2018 11:42:53 +0200
Subject: [PATCH] make atop options configurable, introduce config file
---
atop.daily | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/atop.daily b/atop.daily
index 32a94d8..3539e62 100755
--- a/atop.daily
+++ b/atop.daily
@@ -4,6 +4,7 @@ CURDAY=`date +%Y%m%d`
LOGPATH=/var/log/atop
BINPATH=/usr/bin
PIDFILE=/var/run/atop.pid
+DEFAULTSFILE=/etc/default/atop
INTERVAL=600 # interval 10 minutes
# verify if atop still runs for daily logging
@@ -29,6 +30,11 @@ then
rm $PIDFILE
fi
+ATOPOPTS="-R"
+if [ -e "$DEFAULTSFILE" ]; then
+ . "$DEFAULTSFILE"
+fi
+
# delete logfiles older than four weeks
# start a child shell that activates another child shell in
# the background to avoid a zombie
@@ -38,4 +44,4 @@ fi
# activate atop with interval of 10 minutes, replacing the current shell
#
echo $$ > $PIDFILE
-exec $BINPATH/atop -R -w $LOGPATH/atop_$CURDAY $INTERVAL > $LOGPATH/daily.log 2>&1
+exec $BINPATH/atop $ATOPOPTS -w $LOGPATH/atop_$CURDAY $INTERVAL > $LOGPATH/daily.log 2>&1