diff --git a/.gitignore b/.gitignore index 6afb65f..2aa42b8 100644 --- a/.gitignore +++ b/.gitignore @@ -2,18 +2,3 @@ atop-1.23.tar.gz /atop-1.26.tar.gz /atop-2.0.2.tar.gz /atop-2.1.tar.gz -/atop-2.2-3.tar.gz -/atop-2.3.0.tar.gz -/atop-2.4.0.tar.gz -/atop-2.5.0.tar.gz -/atop-2.6.0.tar.gz -/atop-2.7.0.tar.gz -/atop-2.7.1.tar.gz -/atop-2.8.0.tar.gz -/atop-2.8.1.tar.gz -/atop-2.9.0.tar.gz -/atop-2.10.0.tar.gz -/atop-2.11.0.tar.gz -/atop-2.11.1.tar.gz -/atop-2.12.0.tar.gz -/atop-2.12.1.tar.gz diff --git a/README.fedora b/README.fedora new file mode 100644 index 0000000..add1d50 --- /dev/null +++ b/README.fedora @@ -0,0 +1,14 @@ +A note on logs: + +The /var/log/atop/atop.log file is rotated by logrotate. + +The other, date-stamped logfiles, cannot be correctly handled by logrotate. +Since upstream doesn't provide a method for pruning these, I'm not attempting to do so in the +default configuration of the RPM. If you need to do so, use something like this: + +find /var/log/atop/atop_* -mtime +5 -exec rm {} \; + +This would remove anything older than 5 days, and could be placed in a cron job, etc. + +-Jon Ciesla +2012-05-11 diff --git a/atop-1.26-cron.patch b/atop-1.26-cron.patch new file mode 100644 index 0000000..1a1ec94 --- /dev/null +++ b/atop-1.26-cron.patch @@ -0,0 +1,6 @@ +--- atop.cron~ 2010-11-17 06:47:04.000000000 -0600 ++++ atop.cron 2012-05-10 08:55:45.101712473 -0500 +@@ -1,2 +1,2 @@ + # start atop daily at midnight +-0 0 * * * root /etc/atop/atop.daily ++0 0 * * * root /bin/systemctl try-restart atop.service > /dev/null 2>&1 || : diff --git a/atop-sysconfig.patch b/atop-sysconfig.patch deleted file mode 100644 index 6253b04..0000000 --- a/atop-sysconfig.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- atop.daily~ 2019-01-12 16:37:19.000000000 -0600 -+++ atop.daily 2019-02-25 15:33:13.243363452 -0600 -@@ -7,7 +7,7 @@ - # allow administrator to overrule the variables - # defined above - # --DEFAULTSFILE=/etc/default/atop # possibility to overrule vars -+DEFAULTSFILE=/etc/sysconfig/atop # possibility to overrule vars - - if [ -e "$DEFAULTSFILE" ] - then diff --git a/atop.crondaily b/atop.crondaily new file mode 100644 index 0000000..00071a9 --- /dev/null +++ b/atop.crondaily @@ -0,0 +1,42 @@ +#!/bin/bash + +# load sysconfig atop + +[ -f /etc/sysconfig/atop ] && . /etc/sysconfig/atop +# Current Day format +[ -z $CURDAY ] || CURDAY=`date +%Y%m%d` +# Log files path +[ -z $LOGPATH ] || LOGPATH=/var/log/atop +# Binaries path +[ -z $BINPATH ] || BINPATH=/usr/bin +# PID File +[ -z $PIDFILE ] || PIDFILE=/var/run/atop.pid +# interval (default 10 minutes) +[ -z $INTERVAL ] || INTERVAL=600 + +start_atop() { + +# start atop for all processes with interval of $INTERVAL +# (by default 10) minutes +$BINPATH/atop -a -w $LOGPATH/atop_$CURDAY $INTERVAL > $LOGPATH/atop.log 2>&1 & +echo $! > $PIDFILE +} + +# verify if atop still runs for daily logging +# +if [ -f $PIDFILE ]; then + PID=`cat $PIDFILE` + if [ -s $PIDFILE ] && ps -p $PID | grep 'atop$' > /dev/null + then + kill -USR1 $PID # take final sample + sleep 3 + kill -TERM $PID + rm $PIDFILE + sleep 1 + start_atop + else + exit 1 + fi +fi +exit 0 + diff --git a/atop.init b/atop.init new file mode 100644 index 0000000..f3dcfc6 --- /dev/null +++ b/atop.init @@ -0,0 +1,78 @@ +#! /bin/bash +# +# atop advanced interactive monitor +# +# chkconfig: - 90 60 +# description: atop is advanced interactive monitor +# processname: atop +# pidfile: /var/run/atop.pid +# Source function library. +. /etc/init.d/functions + +RETVAL=0 + +# See how we were called. + +prog="atop" + +start() { + echo -n $"Starting $prog: " + + daemon atopd + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/atop + return $RETVAL +} + +stop() { + echo -n $"Stopping $prog: " + killproc atop 2>/dev/null + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/atop + return $RETVAL +} + +rhstatus() { + status atop +} + +restart() { + stop + start +} + +reload() { + echo -n $"Reloading atop daemon configuration: " + killproc atop -HUP + retval=$? + echo + return $RETVAL +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart) + restart + ;; + reload) + reload + ;; + status) + rhstatus + ;; + condrestart) + [ -f /var/lock/subsys/atop ] && restart || : + ;; + *) + echo $"Usage: $0 {start|stop|status|reload|restart|condrestart}" + exit 1 +esac + +exit $? diff --git a/atop.logrotate b/atop.logrotate new file mode 100644 index 0000000..6253c74 --- /dev/null +++ b/atop.logrotate @@ -0,0 +1,7 @@ +/var/log/atop/atop.log { + missingok + weekly + rotate 4 + notifempty + create 0600 root root +} diff --git a/atop.service b/atop.service new file mode 100644 index 0000000..49b8811 --- /dev/null +++ b/atop.service @@ -0,0 +1,12 @@ +[Unit] +Description=advanced interactive monitor +After=syslog.target + +[Service] +Type=forking +PIDFile=/var/run/atop.pid +ExecStart=/usr/bin/atopd +ExecStop=/bin/rm -f /var/run/atop.pid + +[Install] +WantedBy=multi-user.target diff --git a/atop.spec b/atop.spec index c7c32b4..3821d65 100644 --- a/atop.spec +++ b/atop.spec @@ -1,23 +1,27 @@ %define _hardened_build 1 Name: atop -Version: 2.12.1 -Release: 2%{?dist} +Version: 2.1 +Release: 1%{?dist} Summary: An advanced interactive monitor to view the load on system and process level -License: GPL-2.0-or-later -URL: https://www.atoptool.nl -Source0: https://www.atoptool.nl/download/%{name}-%{version}.tar.gz -Source1: atop.d +Group: Applications/System +License: GPLv2+ +URL: http://www.atcomputing.nl/Tools/atop/ +Source0: http://www.atcomputing.nl/download/%{name}-%{version}.tar.gz +Source1: atop.logrotate +#Source2: atop.init +Source3: atop.crondaily +Source4: atop.sysconfig +Source5: atop.d +Source6: atop.service +Source7: README.fedora -Patch0: atop-sysconfig.patch +Patch0: atop-1.26-cron.patch -BuildRequires: gcc BuildRequires: zlib-devel -BuildRequires: ncurses-devel -BuildRequires: glib2-devel +BuildRequires: ncurses-devel BuildRequires: systemd -BuildRequires: make Requires(post): systemd Requires(preun): systemd @@ -37,247 +41,68 @@ performance-monitors: - Watch deviations only - Accumulated process activity per user - Accumulated process activity per program +For more informations: http://www.atcomputing.nl/Tools/atop +The package does not make use of the patches available at +http://www.atcomputing.nl/Tools/atop/kernpatch.html + %prep %setup -q -%patch -P 0 -p0 -b .sysconfig +%patch0 -p0 -b .cron -# Correct unit file path -sed -i "s|/etc/default/atop|/etc/sysconfig/atop|g" atop.service %build -make %{?_smp_mflags} CFLAGS="$RPM_OPT_FLAGS $(pkg-config --cflags glib-2.0) -I. -std=gnu17" +make %{?_smp_mflags} CFLAGS="$RPM_OPT_FLAGS" + %install install -Dp -m 0755 atop $RPM_BUILD_ROOT%{_bindir}/atop -install -Dp -m 0755 atopconvert $RPM_BUILD_ROOT%{_bindir}/atopconvert ln -s atop $RPM_BUILD_ROOT%{_bindir}/atopsar install -Dp -m 0644 man/atop.1 $RPM_BUILD_ROOT%{_mandir}/man1/atop.1 install -Dp -m 0644 man/atopsar.1 $RPM_BUILD_ROOT%{_mandir}/man1/atopsar.1 -install -Dp -m 0644 man/atopacctd.8 $RPM_BUILD_ROOT%{_mandir}/man8/atopacctd.8 -install -Dp -m 0755 atop.daily $RPM_BUILD_ROOT%{_datadir}/atop/atop.daily -install -Dp -m 0644 atop.default $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/atop -install -Dp -m 0755 %{SOURCE1} $RPM_BUILD_ROOT%{_bindir}/atopd -install -Dp -m 0644 atop.service $RPM_BUILD_ROOT%{_unitdir}/atop.service +install -Dp -m 0644 atop.cron $RPM_BUILD_ROOT%{_sysconfdir}/cron.d/atop +install -Dp -m 0644 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/atop +#install -Dp -m 0755 %{SOURCE2} $RPM_BUILD_ROOT%{_initrddir}/atop +#install -Dp -m 0755 %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/atop/atop.daily +install -Dp -m 0644 %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/atop +install -Dp -m 0755 %{SOURCE5} $RPM_BUILD_ROOT%{_bindir}/atopd +install -Dp -m 0644 %{SOURCE6} $RPM_BUILD_ROOT%{_unitdir}/atop.service install -d $RPM_BUILD_ROOT%{_localstatedir}/log/atop -install -Dp -m 0755 atopacctd $RPM_BUILD_ROOT%{_sbindir}/atopacctd -install -Dp -m 0644 atopacct.service $RPM_BUILD_ROOT%{_unitdir}/atopacct.service -#%%if 0%%{?rhel} >= 8 || 0%%{?fedora} -#install -Dp -m 0755 atopgpud $RPM_BUILD_ROOT%%{_sbindir}/atopgpud -#install -Dp -m 0644 atopgpu.service $RPM_BUILD_ROOT%%{_unitdir}/atopgpu.service -#%%endif -install -Dp -m 0644 atop-rotate.* $RPM_BUILD_ROOT%{_unitdir}/ +install -m 0644 %{SOURCE7} . + %post -%systemd_post atop.service atopacct.service atop-rotate.timer -#%%if 0%%{?rhel} >= 8 || 0%%{?fedora} -#%%systemd_post atopgpu.service -#%%endif +%systemd_post atop.service %preun -%systemd_preun atop.service atopacct.service atop-rotate.timer -#%%if 0%%{?rhel} >= 8 || 0%%{?fedora} -#%%systemd_preun atopgpu.service -#%%endif +%systemd_preun atop.service %postun -%systemd_postun_with_restart atop.service atopacct.service atop-rotate.timer -#%%if 0%%{?rhel} >= 8 || 0%%{?fedora} -#%%systemd_postun_with_restart atopgpu.service -#%%endif +%systemd_postun_with_restart atop.service %files -%if 0%{?rhel} +%if 0%{?rhel} || 0%{?fedora} < 21 %doc COPYING %else %license COPYING %endif -%doc README* +%doc AUTHOR README ChangeLog README.fedora +%config(noreplace) %{_sysconfdir}/cron.d/atop +%config(noreplace) %{_sysconfdir}/logrotate.d/atop %config(noreplace) %{_sysconfdir}/sysconfig/atop +#%{_sysconfdir}/atop/atop.daily +#%{_initrddir}/atop %{_bindir}/atopsar %{_bindir}/atop %{_bindir}/atopd -%{_bindir}/atopconvert %{_mandir}/man1/atop.1.gz %{_mandir}/man1/atopsar.1.gz -%{_mandir}/man8/atopacctd.8.gz %attr(0755,root,root) %dir %{_localstatedir}/log/atop -%{_unitdir}/atop*.service -%{_unitdir}/atop*.timer -%{_datadir}/atop/atop.daily -%{_sbindir}/atopacctd -#%%if 0%%{?rhel} >= 8 || 0%%{?fedora} -#%%{_sbindir}/atopgpud -#%%endif +%{_unitdir}/atop.service + %changelog -* Fri Jan 16 2026 Fedora Release Engineering - 2.12.1-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_44_Mass_Rebuild - -* Tue Sep 23 2025 Gwyn Ciesla - 2.12.1-1 -- 2.12.1 - -* Wed Jul 23 2025 Fedora Release Engineering - 2.12.0-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild - -* Mon Jun 16 2025 Gwyn Ciesla - 2.12.0-1 -- 2.12.0 - -* Mon Mar 31 2025 Gwyn Ciesla - 2.11.1-1 -- 2.11.1 - -* Thu Jan 16 2025 Fedora Release Engineering - 2.11.0-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild - -* Mon Jul 29 2024 Gwyn Ciesla - 2.11.0-1 -- 2.11.0 - -* Wed Jul 17 2024 Fedora Release Engineering - 2.10.0-4 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild - -* Mon Jan 22 2024 Fedora Release Engineering - 2.10.0-3 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild - -* Fri Jan 19 2024 Fedora Release Engineering - 2.10.0-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild - -* Thu Jan 04 2024 Gwyn Ciesla - 2.10.0-1 -- 2.10.0 - -* Wed Jul 19 2023 Fedora Release Engineering - 2.9.0-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild - -* Mon May 15 2023 Gwyn Ciesla - 2.9.0-1 -- 2.9.0 - -* Sun Mar 05 2023 Gwyn Ciesla - 2.8.1-3 -- migrated to SPDX license - -* Wed Jan 18 2023 Fedora Release Engineering - 2.8.1-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild - -* Mon Jan 09 2023 Gwyn Ciesla - 2.8.1-1 -- 2.8.1 - -* Tue Jan 03 2023 Gwyn Ciesla - 2.8.0-1 -- 2.8.0 - -* Wed Dec 07 2022 Gwyn Ciesla - 2.7.1-4 -- Include atopacctd man page - -* Wed Jul 20 2022 Fedora Release Engineering - 2.7.1-3 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild - -* Wed Jan 19 2022 Fedora Release Engineering - 2.7.1-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild - -* Tue Jan 11 2022 Gwyn Ciesla - 2.7.1-1 -- 2.7.1 -- Drop atopgpud as it requires proprietary NVIDIA drivers. - -* Mon Dec 20 2021 Gwyn Ciesla - 2.7.0-1 -- 2.7.0 - -* Wed Jul 21 2021 Fedora Release Engineering - 2.6.0-7 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild - -* Tue Apr 13 2021 Gwyn Ciesla - 2.6.0-6 -- Upstream patch to fix service file. - -* Tue Mar 23 2021 Gwyn Ciesla - 2.6.0-5 -- Use upstream sysconfig file. - -* Tue Mar 02 2021 Zbigniew Jędrzejewski-Szmek - 2.6.0-4 -- Rebuilt for updated systemd-rpm-macros - See https://pagure.io/fesco/issue/2583. - -* Mon Feb 22 2021 Gwyn Ciesla - 2.6.0-3 -- Don't ship atopgpud on EL-7 - -* Tue Jan 26 2021 Fedora Release Engineering - 2.6.0-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild - -* Mon Dec 21 2020 Gwyn Ciesla - 2.6.0-1 -- 2.6.0 - -* Mon Jul 27 2020 Fedora Release Engineering - 2.5.0-4 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild - -* Fri May 29 2020 Gwyn Ciesla - 2.5.1-1 -- Fix unit file path. - -* Tue Jan 28 2020 Fedora Release Engineering - 2.5.0-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild - -* Sun Nov 03 2019 Gwyn Ciesla - 2.5.0-1 -- 2.5.0 - -* Thu Sep 05 2019 Gwyn Ciesla - 2.4.0-4 -- Package atopacctd. - -* Wed Aug 28 2019 Gwyn Ciesla - 2.4.0-3 -- Fix LOGINTERVAL in sysconfig. - -* Wed Jul 24 2019 Fedora Release Engineering - 2.4.0-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild - -* Mon Feb 25 2019 Gwyn Ciesla - 2.4.0-1 -- 2.4.0: omitting atopgpud until nvidia-ml-py is in Fedora. - -* Thu Jan 31 2019 Fedora Release Engineering - 2.3.0-13 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild - -* Fri Sep 14 2018 Filipe Rosset - 2.3.0-12 -- Fix FTBFS rhbz #1603433 - -* Thu Jul 12 2018 Fedora Release Engineering - 2.3.0-11 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild - -* Fri Feb 09 2018 Igor Gnatenko - 2.3.0-10 -- Escape macros in %%changelog - -* Wed Feb 07 2018 Fedora Release Engineering - 2.3.0-9 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild - -* Fri Dec 29 2017 Gwyn Ciesla - 2.3.0-8 -- Apply the patch from the previous ENVR. - -* Mon Dec 11 2017 Gwyn Ciesla - 2.3.0-7 -- try-restart in cron, not restart, BZ 1524436. - -* Fri Dec 08 2017 Gwyn Ciesla - 2.3.0-6 -- Drop obsolete README.fedora. - -* Fri Dec 08 2017 Gwyn Ciesla - 2.3.0-5 -- Patch to support nvme disks, BZ 1523419. -- Patch to support /etc/sysconfig/atop, BZ 1520475. - -* Tue Nov 07 2017 Gwyn Ciesla - 2.3.0-4 -- Move from logrotate to upstream script. - -* Wed Aug 02 2017 Fedora Release Engineering - 2.3.0-3 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild - -* Wed Jul 26 2017 Fedora Release Engineering - 2.3.0-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild - -* Wed Mar 29 2017 Gwyn Ciesla - 2.3.0-1 -- 2.3.0, BZ 1436833. - -* Fri Feb 10 2017 Fedora Release Engineering - 2.2-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild - -* Wed Dec 21 2016 Jon Ciesla - 2.2-1 -- Fix logrotate, 1247869 -- 2.2 - -* Wed Feb 03 2016 Fedora Release Engineering - 2.1-3 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild - -* Wed Jun 17 2015 Fedora Release Engineering - 2.1-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild - * Thu May 7 2015 Richard Shaw - 2.1-1 - Update to latest upstream release. - Fixes segmentation faults (BZ#1147145). @@ -380,7 +205,7 @@ install -Dp -m 0644 atop-rotate.* $RPM_BUILD_ROOT%{_unitdir}/ * Sun Jan 27 2008 Kairo Araujo - 1.22-2 - corrected license tag to GPLv2+ - replaced references to atop (init file) -- rebuild with Fedora mandatory flags (make %%{?_smp_mflags} CFLAGS="$RPM_OPT_FLAGS") +- rebuild with Fedora mandatory flags (make %{?_smp_mflags} CFLAGS="$RPM_OPT_FLAGS") - chkconfig and service added at pre/post scriptlets - improved name in logrotate file configuration - corrected english description diff --git a/atop.sysconfig b/atop.sysconfig new file mode 100644 index 0000000..12d376a --- /dev/null +++ b/atop.sysconfig @@ -0,0 +1,13 @@ +# sysconfig atop +# + +# Current Day format +CURDAY=`date +%Y%m%d` +# Log files path +LOGPATH=/var/log/atop +# Binaries path +BINPATH=/usr/bin +# PID File +PIDFILE=/var/run/atop.pid +# interval (default 10 minutes) +INTERVAL=600 diff --git a/sources b/sources index 5ba284b..f382000 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (atop-2.12.1.tar.gz) = e01db51bf025598e7bad585f62761e10d23a77f6c7be96418bc8919a72c74628851ae5cbdc0c12ed752f80b44f5b72f2102692dbbb3210cacc59b32340107ce7 +d956f5b0c7e0705cff6cf44898d664d7 atop-2.1.tar.gz