summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-05-04 15:32:07 +0200
committerGitHub <noreply@github.com>2020-05-04 15:32:07 +0200
commit3b96d6ca9f8474c26b8a5514c022068f6387d950 (patch)
treecde189aabc05563fd48d760a23820ada8256be61
parent9e650f8665473117e2bd1ce3d914a3baed28c8a1 (diff)
parente1e2364ee0af364fad91b9827032452bc0b9f478 (diff)
downloadvyos-build-3b96d6ca9f8474c26b8a5514c022068f6387d950.tar.gz
vyos-build-3b96d6ca9f8474c26b8a5514c022068f6387d950.zip
Merge pull request #104 from DmitriyEshenko/crux-atop-lr
atop: T1982: Add logrotate for atop binary log
-rwxr-xr-xdata/live-build-config/hooks/live/30-atop_logrotate.chroot25
1 files changed, 25 insertions, 0 deletions
diff --git a/data/live-build-config/hooks/live/30-atop_logrotate.chroot b/data/live-build-config/hooks/live/30-atop_logrotate.chroot
new file mode 100755
index 00000000..c879104f
--- /dev/null
+++ b/data/live-build-config/hooks/live/30-atop_logrotate.chroot
@@ -0,0 +1,25 @@
+#!/usr/bin/env python
+
+# Enable ratation log for atop binari files
+
+atop_lrotate = """
+/run/atop/atop.acct {
+ rotate 0
+ nomissingok
+ size 50M
+ postrotate
+ PIDFILE=/run/atop.pid
+ if [ -e $PIDFILE ] && \
+ ps -p `cat $PIDFILE` | grep 'atop$' > /dev/null
+ then
+ kill -15 `cat $PIDFILE`
+ rm $PIDFILE
+ fi
+ sleep 1
+ /etc/init.d/atop restart
+ endscript
+}
+"""
+
+with open("/etc/logrotate.d/atop", "w") as f:
+ f.write(atop_lrotate)