Accepting request 744712 from home:pmonrealgonzalez:branches:Base:System

- Enable log information on service start/stop [bsc#1144923, jsc#SLE-5958]

- Migrate from cron to systemd timer units [bsc#1151453]
  * Add sysstat-collect.{service,timer} and sysstat-summary.{service,timer}
  * Remove sysstat.cron.suse

OBS-URL: https://build.opensuse.org/request/show/744712
OBS-URL: https://build.opensuse.org/package/show/Base:System/sysstat?expand=0&rev=102
This commit is contained in:
Tomáš Chvátal 2019-11-01 10:02:41 +00:00 committed by Git OBS Bridge
parent 092890eb6a
commit 8ef9f62b6b
8 changed files with 73 additions and 25 deletions

9
sysstat-collect.service Normal file
View File

@ -0,0 +1,9 @@
[Unit]
Description=system activity accounting tool
Documentation=man:sa1(8)
After=sysstat.service
[Service]
Type=oneshot
User=root
ExecStart=/usr/lib/sa/sa1 1 1

8
sysstat-collect.timer Normal file
View File

@ -0,0 +1,8 @@
[Unit]
Description=Run system activity accounting tool every 10 minutes
[Timer]
OnCalendar=*:00/10
[Install]
WantedBy=sysstat.service

9
sysstat-summary.service Normal file
View File

@ -0,0 +1,9 @@
[Unit]
Description=Generate a daily summary of process accounting
Documentation=man:sa2(8)
After=sysstat.service
[Service]
Type=oneshot
User=root
ExecStart=/usr/lib/sa/sa2 -A

8
sysstat-summary.timer Normal file
View File

@ -0,0 +1,8 @@
[Unit]
Description=Generate summary of yesterday's process accounting
[Timer]
OnCalendar=00:07:00
[Install]
WantedBy=sysstat.service

View File

@ -1,3 +1,15 @@
-------------------------------------------------------------------
Wed Oct 30 18:49:50 UTC 2019 - Pedro Monreal Gonzalez <pmonrealgonzalez@suse.com>
- Enable log information on service start/stop [bsc#1144923, jsc#SLE-5958]
-------------------------------------------------------------------
Tue Oct 29 18:00:14 UTC 2019 - Pedro Monreal Gonzalez <pmonrealgonzalez@suse.com>
- Migrate from cron to systemd timer units [bsc#1151453]
* Add sysstat-collect.{service,timer} and sysstat-summary.{service,timer}
* Remove sysstat.cron.suse
-------------------------------------------------------------------
Thu Oct 10 13:18:26 UTC 2019 - Guillaume GARDET <guillaume.gardet@opensuse.org>

View File

@ -1,7 +0,0 @@
# crontab for sysstat
# Activity reports every 10 minutes everyday
*/10 * * * * root [ -x /usr/lib/sa/sa1 ] && exec /usr/lib/sa/sa1 -S ALL 1 1
# Update reports every 6 hours
55 5,11,17,23 * * * root [ -x /usr/lib/sa/sa2 ] && exec /usr/lib/sa/sa2 -A

View File

@ -1,15 +1,15 @@
[Unit]
Description=Write information about system start to sysstat log
After=remote-fs.target local-fs.target
Before=cron.service
[Service]
Type=oneshot
ExecStart=/usr/lib/sa/sa1 --boot
ExecStart=/bin/ln -fs /etc/sysstat/sysstat.cron /etc/cron.d/sysstat
ExecStop=/bin/rm -f /etc/cron.d/sysstat
ExecStart=/usr/lib/sa/sa1 --boot
ExecStop=/usr/lib/sa/sa1 1 1
StandardOutput=null
RemainAfterExit=true
[Install]
WantedBy=multi-user.target
Also=sysstat-collect.timer
Also=sysstat-summary.timer

View File

@ -25,8 +25,11 @@ Group: System/Monitoring
URL: http://pagesperso-orange.fr/sebastien.godard/
Source: http://pagesperso-orange.fr/sebastien.godard/%{name}-%{version}.tar.xz
Source1: isag.desktop
Source2: sysstat.cron.suse
Source4: sysstat.service
Source2: sysstat.service
Source3: sysstat-collect.service
Source4: sysstat-collect.timer
Source5: sysstat-summary.service
Source6: sysstat-summary.timer
# PATCH-FIX-OPENSUSE should be upstreamed
# add locking to scripts sa1 and sa2 (bnc#7861)
Patch0: sysstat-8.1.6-sa1sa2lock.diff
@ -42,7 +45,6 @@ BuildRequires: sed
BuildRequires: systemd-rpm-macros
BuildRequires: update-desktop-files
BuildRequires: pkgconfig(systemd)
Requires: cron
Requires: procmail
Requires: xz
%{?systemd_requires}
@ -75,16 +77,16 @@ from a sysstat package.
%patch0 -p1
%patch2 -p1
%patch3 -p1
cp %{SOURCE1} %{SOURCE2} %{SOURCE4} .
cp %{S:1} %{S:2} %{S:3} %{S:4} %{S:5} %{S:6} .
# remove date and time from objects
find ./ -name \*.c -exec sed -i -e 's: " compiled " __DATE__ " " __TIME__::g' {} \;
%build
export conf_dir="%{_sysconfdir}/sysstat"
export sa_lib_dir="%{_libdir}/sa"
export cron_owner=root
export LFLAGS="-L. -lsyscom"
export history="60"
export SADC_OPT="-S ALL"
%configure \
--disable-silent-rules \
--enable-nls \
@ -106,32 +108,36 @@ install -D -m 0644 isag.desktop %{buildroot}%{_datadir}/applications/isag.deskto
cp contrib/isag/isag %{buildroot}%{_bindir}
cp contrib/isag/isag.1 %{buildroot}%{_mandir}/man1
rm -rf %{buildroot}%{_datadir}/doc/sysstat*
install -D -m 0755 sysstat.cron.suse %{buildroot}%{_sysconfdir}/sysstat/sysstat.cron
ln -sf %{_sbindir}/service %{buildroot}%{_sbindir}/rcsysstat
%find_lang %{name}
install -D -m 0644 %{SOURCE4} %{buildroot}%{_unitdir}/sysstat.service
install -D -m 0644 %{S:2} %{buildroot}%{_unitdir}/sysstat.service
install -D -m 0644 %{S:3} %{buildroot}%{_unitdir}/sysstat-collect.service
install -D -m 0644 %{S:4} %{buildroot}%{_unitdir}/sysstat-collect.timer
install -D -m 0644 %{S:5} %{buildroot}%{_unitdir}/sysstat-summary.service
install -D -m 0644 %{S:6} %{buildroot}%{_unitdir}/sysstat-summary.timer
# change /usr/lib to /usr/lib64 or something else when needed
if [ "%{_libdir}" != "%{_libexecdir}" ]; then
sed -i 's:%{_libexecdir}/:%{_libdir}/:g' \
%{buildroot}%{_sysconfdir}/sysstat/sysstat.cron \
%{buildroot}%{_unitdir}/sysstat.service
%{buildroot}%{_unitdir}/sysstat.service \
%{buildroot}%{_unitdir}/sysstat-collect.service \
%{buildroot}%{_unitdir}/sysstat-summary.service
fi
%check
make %{?_smp_mflags} test
%pre
%service_add_pre sysstat.service
%service_add_pre sysstat.service sysstat-collect.timer sysstat-summary.timer
%preun
%service_del_preun sysstat.service
%service_del_preun sysstat.service sysstat-collect.timer sysstat-summary.timer
[ "$1" -gt 0 ] || rm -rf %{_localstatedir}/log/sa/*
%post
%service_add_post sysstat.service
%service_add_post sysstat.service sysstat-collect.timer sysstat-summary.timer
%postun
%service_del_postun sysstat.service
%service_del_postun sysstat.service sysstat-collect.timer sysstat-summary.timer
%if 0%{?suse_version} < 1500
%post isag
@ -150,7 +156,6 @@ make %{?_smp_mflags} test
%exclude %{_mandir}/man1/isag*
%dir %{_sysconfdir}/sysstat
%config(noreplace) %{_sysconfdir}/sysstat/sysstat
%attr(644,root,root) %config(noreplace) %{_sysconfdir}/sysstat/sysstat.cron
%attr(644,root,root) %config(noreplace) %{_sysconfdir}/sysstat/sysstat.ioconf
%{_bindir}/cifsiostat
%{_bindir}/iostat
@ -162,6 +167,10 @@ make %{?_smp_mflags} test
%exclude %{_bindir}/isag
%{_libdir}/sa
%{_unitdir}/sysstat.service
%{_unitdir}/sysstat-collect.service
%{_unitdir}/sysstat-collect.timer
%{_unitdir}/sysstat-summary.service
%{_unitdir}/sysstat-summary.timer
%dir %{_localstatedir}/log/sa
%{_sbindir}/rcsysstat