From e1e2364ee0af364fad91b9827032452bc0b9f478 Mon Sep 17 00:00:00 2001 From: DmitriyEshenko Date: Mon, 4 May 2020 07:34:10 +0000 Subject: atop: T1982: Add logrotate for atop binary log --- .../hooks/live/30-atop_logrotate.chroot | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 data/live-build-config/hooks/live/30-atop_logrotate.chroot 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) -- cgit v1.2.3