Package init
This commit is contained in:
commit
0b00cbe844
BIN
acct-6.6.4.tar.gz
Normal file
BIN
acct-6.6.4.tar.gz
Normal file
Binary file not shown.
5
accton-create
Normal file
5
accton-create
Normal file
@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
ACCTFILE=/var/account/pacct
|
||||
if [ ! -r $ACCTFILE ];then
|
||||
touch $ACCTFILE && chmod 600 $ACCTFILE
|
||||
fi
|
||||
14
psacct-6.6.1-SEGV-when-record-incomplete.patch
Normal file
14
psacct-6.6.1-SEGV-when-record-incomplete.patch
Normal file
@ -0,0 +1,14 @@
|
||||
diff -Naur acct-6.6.1.orig/file_rd.c acct-6.6.1/file_rd.c
|
||||
--- acct-6.6.1.orig/file_rd.c 2011-03-16 23:50:13.000000000 +0100
|
||||
+++ acct-6.6.1/file_rd.c 2013-10-10 14:21:21.801097725 +0200
|
||||
@@ -118,6 +118,10 @@
|
||||
? max_recs
|
||||
: fri->buffered_records);
|
||||
|
||||
+ /* Preventing SEGV when incomplete record appears */
|
||||
+ if (recs_to_read==0)
|
||||
+ goto no_more_records;
|
||||
+
|
||||
/* Move back in the file */
|
||||
|
||||
(void)fseek(fri->fp, -fri->record_size * recs_to_read,
|
||||
21
psacct-6.6.2-unnumberedsubsubsec.patch
Normal file
21
psacct-6.6.2-unnumberedsubsubsec.patch
Normal file
@ -0,0 +1,21 @@
|
||||
diff -Naur acct-6.6.2.orig/accounting.texi acct-6.6.2/accounting.texi
|
||||
--- acct-6.6.2.orig/accounting.texi 2014-11-08 05:46:16.000000000 +0100
|
||||
+++ acct-6.6.2/accounting.texi 2014-11-28 19:08:02.935000000 +0100
|
||||
@@ -491,7 +491,7 @@
|
||||
@code{ac} (provided you specify the other flags that will make GNU
|
||||
@code{ac} behave like the system's).
|
||||
|
||||
-@unnumberedsubsubsec The Shutdown/Reboot Problem
|
||||
+@unnumberedsubsec The Shutdown/Reboot Problem
|
||||
|
||||
On Suns, @code{init} is a little screwed up. For some reason, after a
|
||||
shutdown record is written, a reboot record is written with a time-stamp
|
||||
@@ -513,7 +513,7 @@
|
||||
60 second default is that of all of the machines with this problem, the
|
||||
largest timewarp was 45.
|
||||
|
||||
-@unnumberedsubsubsec Stupid System V Machines
|
||||
+@unnumberedsubsec Stupid System V Machines
|
||||
|
||||
Some @code{ac}'s on System V machines (I've tried SGI Indigo & SGI Indy)
|
||||
forget to pay attention to the @code{ut_type} field in a @code{struct
|
||||
13
psacct-6.6.4-lastcomm-manpage-pid-twice.patch
Normal file
13
psacct-6.6.4-lastcomm-manpage-pid-twice.patch
Normal file
@ -0,0 +1,13 @@
|
||||
diff -up ./lastcomm.1.ori ./lastcomm.1
|
||||
--- ./lastcomm.1.ori 2018-06-19 17:50:43.223211872 +0200
|
||||
+++ ./lastcomm.1 2018-06-19 17:50:58.211147752 +0200
|
||||
@@ -125,9 +125,6 @@ format as your current machine, but has
|
||||
Print paging statistics.
|
||||
.TP
|
||||
.B \-\-pid
|
||||
-Show PID and PPID of the process if acct version 3 format is supported by kernel.
|
||||
-.TP
|
||||
-.B \-\-pid
|
||||
Add pid of the process and pid of the process parent to the output
|
||||
(pid is the last but one and parent pid the last column).
|
||||
These values are shown only when they are generated by acct function
|
||||
15
psacct-logrotate.in
Normal file
15
psacct-logrotate.in
Normal file
@ -0,0 +1,15 @@
|
||||
# Logrotate file for psacct RPM
|
||||
|
||||
/var/account/pacct {
|
||||
compress
|
||||
delaycompress
|
||||
notifempty
|
||||
daily
|
||||
rotate 31
|
||||
create 0600 root root
|
||||
postrotate
|
||||
if %{_bindir}/systemctl --quiet is-active psacct.service ; then
|
||||
%{_sbindir}/accton /var/account/pacct | %{_bindir}/grep -v "Turning on process accounting, file set to '/var/account/pacct'." | %{_bindir}/cat
|
||||
fi
|
||||
endscript
|
||||
}
|
||||
14
psacct.service
Normal file
14
psacct.service
Normal file
@ -0,0 +1,14 @@
|
||||
[Unit]
|
||||
Description=Kernel process accounting
|
||||
After=syslog.target
|
||||
ConditionPathExists=/var/account
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStartPre=/usr/libexec/psacct/accton-create
|
||||
ExecStart=/usr/sbin/accton /var/account/pacct
|
||||
ExecStop=/usr/sbin/accton off
|
||||
RemainAfterExit=yes
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
109
psacct.spec
Normal file
109
psacct.spec
Normal file
@ -0,0 +1,109 @@
|
||||
Name: psacct
|
||||
Version: 6.6.4
|
||||
Release: 3
|
||||
Summary: Utilities for monitoring process activities
|
||||
License: GPLv3+
|
||||
URL: http://www.gnu.org/software/acct/
|
||||
Source: ftp://ftp.gnu.org/pub/gnu/acct/acct-%{version}.tar.gz
|
||||
Source1: psacct.service
|
||||
Source2: psacct-logrotate.in
|
||||
Source3: accton-create
|
||||
Patch0001: psacct-6.6.2-unnumberedsubsubsec.patch
|
||||
Patch0002: psacct-6.6.1-SEGV-when-record-incomplete.patch
|
||||
Patch0003: psacct-6.6.4-lastcomm-manpage-pid-twice.patch
|
||||
BuildRequires: autoconf systemd gcc
|
||||
Requires: info coreutils
|
||||
Requires(post): chkconfig systemd-sysv systemd
|
||||
Requires(preun): systemd
|
||||
Requires(postun): systemd
|
||||
Conflicts: filesystem < 3
|
||||
|
||||
%description
|
||||
The psacct package contains several utilities for monitoring process
|
||||
activities, including ac, lastcomm, accton and sa:
|
||||
The ac command displays statistics about how long users have been logged on.
|
||||
The lastcomm command displays information about previous executed commands.
|
||||
The accton command turns process accounting on or off.
|
||||
The sa command summarizes information about previously executed commands.
|
||||
|
||||
%package help
|
||||
Summary: Help documents for psacct
|
||||
|
||||
%description help
|
||||
The psacct-help package conatins manual pages and other related files for psacct.
|
||||
|
||||
%prep
|
||||
%autosetup -n acct-%{version} -p1
|
||||
|
||||
sed -i 's|.*(gets,.*||g' lib/stdio.in.h
|
||||
sed -i 's|@ACCT_FILE_LOC@|/var/account/pacct|g' files.h.in
|
||||
sed -i 's|@SAVACCT_FILE_LOC@|/var/account/savacct|g' files.h.in
|
||||
sed -i 's|@USRACCT_FILE_LOC@|/var/account/usracct|g' files.h.in
|
||||
|
||||
%build
|
||||
%configure --enable-linux-multiformat
|
||||
|
||||
make
|
||||
|
||||
%install
|
||||
install -d %{buildroot}{/sbin,%{_bindir},%{_mandir},%{_sbindir}}
|
||||
make install prefix=%{buildroot}%{_prefix} \
|
||||
bindir=%{buildroot}%{_bindir} sbindir=%{buildroot}%{_sbindir} \
|
||||
infodir=%{buildroot}%{_datadir}/info mandir=%{buildroot}%{_mandir}
|
||||
cp dump-acct.8 %{buildroot}%{_mandir}/man8/
|
||||
|
||||
install -d %{buildroot}/var/account
|
||||
touch %{buildroot}/var/account/pacct && chmod 0600 %{buildroot}/var/account/pacct
|
||||
|
||||
install -d %{buildroot}/etc/logrotate.d
|
||||
sed -e 's|%%{_bindir}|%{_bindir}|g' -e 's|%%{_sbindir}|%{_sbindir}|g' %{SOURCE2} > %{buildroot}/etc/logrotate.d/psacct
|
||||
|
||||
install -d %{buildroot}%{_unitdir}
|
||||
install -m644 %{SOURCE1} %{buildroot}%{_unitdir}
|
||||
|
||||
install -d -m0755 %{buildroot}%{_libexecdir}/psacct
|
||||
install -m755 %{SOURCE3} %{buildroot}%{_libexecdir}/psacct/
|
||||
|
||||
%post
|
||||
%systemd_post psacct.service
|
||||
|
||||
/sbin/install-info %{_infodir}/accounting.info %{_infodir}/dir || :
|
||||
touch /var/account/pacct && chmod 0600 /var/account/pacct
|
||||
|
||||
%preun
|
||||
%systemd_preun psacct.service
|
||||
|
||||
if [ $1 -eq 0 ]; then
|
||||
/sbin/install-info --delete %{_infodir}/accounting.info %{_infodir}/dir || :
|
||||
fi
|
||||
|
||||
%postun
|
||||
%systemd_postun_with_restart psacct.service
|
||||
|
||||
%triggerun -- psacct < 6.5.5-3
|
||||
%{_bindir}/systemd-sysv-convert --save psacct >/dev/null 2>&1 ||:
|
||||
/sbin/chkconfig --del psacct >/dev/null 2>&1 || :
|
||||
/bin/systemctl try-restart psacct.service >/dev/null 2>&1 || :
|
||||
|
||||
%files
|
||||
%doc README COPYING
|
||||
%dir /var/account
|
||||
%{_bindir}/{ac,lastcomm}
|
||||
%{_unitdir}/psacct.service
|
||||
%{_infodir}/accounting.info.gz
|
||||
%{_libexecdir}/psacct/accton-create
|
||||
%{_sbindir}/{accton,sa,dump-utmp,dump-acct}
|
||||
%attr(0600,root,root) %ghost %config /var/account/pacct
|
||||
%attr(0644,root,root) %config(noreplace) /etc/logrotate.d/*
|
||||
%exclude %{_bindir}/last
|
||||
%exclude %{_infodir}/dir
|
||||
|
||||
%files help
|
||||
%{_mandir}/man1/*
|
||||
%{_mandir}/man8/*
|
||||
%exclude %{_mandir}/man1/last.1*
|
||||
|
||||
%changelog
|
||||
* Wed Nov 06 2019 yanzhihua <yanzhihua4@huawei.com> - 6.6.4-3
|
||||
- Package init
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user