Codebase list atop / 5fd46c9
add patch to better handle coexistence with the acct package Closes: #922224 Thanks: Sergio Gelato Marc Haber 3 years ago
2 changed file(s) with 83 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 Description: better handle coexistence with acct, see #922224
1 Author: Marc Haber <mh+debian-packages@zugschlus.de>
2 Forwarded: not yet
3 Last-Update: 2019-02-17
4 --- a/acctproc.c
5 +++ b/acctproc.c
6 @@ -158,7 +158,8 @@ struct pacctadm {
7 struct stat stat;
8 } pacctadm[] = {
9 { "/var/log/pacct", {0, }, },
10 - { "/var/account/pacct", {0, }, }
11 + { "/var/account/pacct", {0, }, },
12 + { "/var/log/account/pacct", {0, }, }
13 };
14
15 /*
16 --- a/atopacct.init
17 +++ b/atopacct.init
18 @@ -29,7 +29,7 @@ case "$1" in
19 start)
20 # Check if process accounting already in use via psacct
21 #
22 - for PACCTFILE in /var/account/pacct /var/log/pacct
23 + for PACCTFILE in /var/account/pacct /var/log/pacct /var/log/account/pacct
24 do
25 if [ -f "$PACCTFILE" ] # file exists?
26 then
27 --- a/man/atop.1
28 +++ b/man/atop.1
29 @@ -162,11 +162,14 @@ daemon is not active,
30 verifies if the process accounting mechanism has been switched on
31 via the separate
32 .B psacct
33 -package. In that case, the file
34 -.B /var/account/pacct
35 -is in use as process accounting file and
36 +package. In that case, the files
37 +.B /var/account/pacct,
38 +.B /var/log/account/pacct
39 +and
40 +.B /var/log/pacct
41 +are considered to be in use as process accounting file and
42 .I atop
43 -opens this file for reading.
44 +opens the respective file for reading.
45 .PP
46 .TP 4
47 4.
48 --- a/psaccs_atop
49 +++ b/psaccs_atop
50 @@ -10,11 +10,18 @@
51 postrotate
52 # check if process accounting is installed
53 #
54 - if [ -e /etc/logrotate.d/psacct ]
55 + if [ -e /etc/logrotate.d/psacct ] || grep -q 'savelog' /etc/cron.daily/acct
56 then
57 # check if process accounting is actually in use
58 #
59 - ACCTFILE=`awk '$2 == "{" {print $1}' /etc/logrotate.d/psacct`
60 + if [ -e /etc/logrotate.d/psacct ]
61 + then
62 + ACCTFILE=`awk '$2 == "{" {print $1}' /etc/logrotate.d/psacct`
63 + fi
64 + if grep -q 'savelog' /etc/cron.daily/acct
65 + then
66 + ACCTFILE=`sed -n "/savelog[^\/]\+\(\/[[:alnum:]\/]\+\).*/{s//\1/;p;q;}" /etc/cron.daily/acct`
67 + fi
68
69 if [ -f "$ACCTFILE" ]
70 then
71 --- a/psaccu_atop
72 +++ b/psaccu_atop
73 @@ -8,7 +8,7 @@
74 ifempty
75 create 0600 root root
76 postrotate
77 - if [ -e /etc/logrotate.d/psacct ]
78 + if [ -e /etc/logrotate.d/psacct ] || grep -q 'savelog.*/var/log/account/pacct' /etc/cron.daily/acct
79 then
80 # if the atop daemon does not run, restart it after
81 # accounting file is rotated
1212 atop-pm
1313 no-atopgpud
1414 handle-default-file
15 acct-compat