summaryrefslogtreecommitdiff
path: root/data/live-build-config/hooks/live/30-atop_logrotate.chroot
blob: c879104ff0e7f6698102fd2f660bc22df4c9d0a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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)