Replace raid-check cron job with systemd timer
This commit is contained in:
parent
798932b8b6
commit
8491dee042
@ -1,3 +0,0 @@
|
|||||||
# Run system wide raid-check once a week on Sunday at 1am by default
|
|
||||||
0 1 * * Sun root /usr/sbin/raid-check
|
|
||||||
|
|
40
mdadm.spec
40
mdadm.spec
@ -1,7 +1,7 @@
|
|||||||
Name: mdadm
|
Name: mdadm
|
||||||
Version: 4.1
|
Version: 4.1
|
||||||
#define subversion rc2
|
#define subversion rc2
|
||||||
Release: 2%{?subversion:.%{subversion}}%{?dist}
|
Release: 3%{?subversion:.%{subversion}}%{?dist}
|
||||||
Summary: The mdadm program controls Linux md devices (software RAID arrays)
|
Summary: The mdadm program controls Linux md devices (software RAID arrays)
|
||||||
URL: http://www.kernel.org/pub/linux/utils/raid/mdadm/
|
URL: http://www.kernel.org/pub/linux/utils/raid/mdadm/
|
||||||
License: GPLv2+
|
License: GPLv2+
|
||||||
@ -10,10 +10,11 @@ Source: http://www.kernel.org/pub/linux/utils/raid/mdadm/%{name}-%{version}
|
|||||||
Source1: raid-check
|
Source1: raid-check
|
||||||
Source2: mdadm.rules
|
Source2: mdadm.rules
|
||||||
Source3: mdadm-raid-check-sysconfig
|
Source3: mdadm-raid-check-sysconfig
|
||||||
Source4: mdadm-cron
|
Source4: mdmonitor.service
|
||||||
Source5: mdmonitor.service
|
Source5: mdadm.conf
|
||||||
Source6: mdadm.conf
|
Source6: mdadm_event.conf
|
||||||
Source7: mdadm_event.conf
|
Source7: raid-check.timer
|
||||||
|
Source8: raid-check.service
|
||||||
|
|
||||||
# Build without -Werror. From Debian.
|
# Build without -Werror. From Debian.
|
||||||
Patch00: https://sources.debian.org/data/main/m/mdadm/4.1-2/debian/patches/debian-no-Werror.diff#/mdadm-4.1-no-Werror.patch
|
Patch00: https://sources.debian.org/data/main/m/mdadm/4.1-2/debian/patches/debian-no-Werror.diff#/mdadm-4.1-no-Werror.patch
|
||||||
@ -22,7 +23,7 @@ Patch00: https://sources.debian.org/data/main/m/mdadm/4.1-2/debian/patches/d
|
|||||||
Patch97: mdadm-3.3-udev.patch
|
Patch97: mdadm-3.3-udev.patch
|
||||||
Patch98: mdadm-2.5.2-static.patch
|
Patch98: mdadm-2.5.2-static.patch
|
||||||
|
|
||||||
BuildRequires: systemd binutils-devel gcc
|
BuildRequires: systemd-rpm-macros binutils-devel gcc
|
||||||
Requires: libreport-filesystem
|
Requires: libreport-filesystem
|
||||||
Requires(post): systemd coreutils
|
Requires(post): systemd coreutils
|
||||||
Requires(preun): systemd
|
Requires(preun): systemd
|
||||||
@ -42,33 +43,40 @@ file can be used to help with some common tasks.
|
|||||||
make %{?_smp_mflags} CXFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS" SYSCONFDIR="%{_sysconfdir}" mdadm mdmon
|
make %{?_smp_mflags} CXFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS" SYSCONFDIR="%{_sysconfdir}" mdadm mdmon
|
||||||
|
|
||||||
%install
|
%install
|
||||||
make DESTDIR=%{buildroot} MANDIR=%{_mandir} BINDIR=%{_sbindir} SYSTEMD_DIR=%{_unitdir} install install-systemd
|
make DESTDIR=%{buildroot} MANDIR=%{_mandir} BINDIR=%{_sbindir} SYSTEMD_DIR=%{_unitdir} UDEVDIR=%{_udevrulesdir} install install-systemd
|
||||||
install -Dp -m 755 %{SOURCE1} %{buildroot}%{_sbindir}/raid-check
|
install -Dp -m 755 %{SOURCE1} %{buildroot}%{_sbindir}/raid-check
|
||||||
install -Dp -m 644 %{SOURCE2} %{buildroot}%{_udevrulesdir}/65-md-incremental.rules
|
install -Dp -m 644 %{SOURCE2} %{buildroot}%{_udevrulesdir}/65-md-incremental.rules
|
||||||
install -Dp -m 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/sysconfig/raid-check
|
install -Dp -m 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/sysconfig/raid-check
|
||||||
install -Dp -m 644 %{SOURCE4} %{buildroot}%{_sysconfdir}/cron.d/raid-check
|
|
||||||
mkdir -p -m 710 %{buildroot}/run/mdadm
|
mkdir -p -m 710 %{buildroot}/run/mdadm
|
||||||
|
|
||||||
# systemd
|
# systemd
|
||||||
mkdir -p %{buildroot}%{_unitdir}
|
mkdir -p %{buildroot}%{_unitdir}
|
||||||
install -m644 %{SOURCE5} %{buildroot}%{_unitdir}
|
install -m644 %{SOURCE4} %{buildroot}%{_unitdir}
|
||||||
|
install -m644 %{SOURCE7} %{buildroot}%{_unitdir}
|
||||||
|
install -m644 %{SOURCE8} %{buildroot}%{_unitdir}
|
||||||
|
|
||||||
# tmpfile
|
# tmpfile
|
||||||
mkdir -p %{buildroot}%{_tmpfilesdir}
|
mkdir -p %{buildroot}%{_tmpfilesdir}
|
||||||
install -m 0644 %{SOURCE6} %{buildroot}%{_tmpfilesdir}/%{name}.conf
|
install -m 0644 %{SOURCE5} %{buildroot}%{_tmpfilesdir}/%{name}.conf
|
||||||
mkdir -p %{buildroot}%{_localstatedir}/run/
|
mkdir -p %{buildroot}%{_localstatedir}/run/
|
||||||
install -d -m 0710 %{buildroot}/run/%{name}/
|
install -d -m 0710 %{buildroot}/run/%{name}/
|
||||||
|
|
||||||
# abrt
|
# abrt
|
||||||
mkdir -p %{buildroot}/etc/libreport/events.d
|
mkdir -p %{buildroot}/etc/libreport/events.d
|
||||||
install -m644 %{SOURCE7} %{buildroot}/etc/libreport/events.d
|
install -m644 %{SOURCE6} %{buildroot}/etc/libreport/events.d
|
||||||
|
|
||||||
%post
|
%post
|
||||||
%systemd_post mdmonitor.service
|
%systemd_post mdmonitor.service raid-check.{service,timer}
|
||||||
/usr/bin/systemctl disable mdmonitor-takeover.service >/dev/null 2>&1 || :
|
%{_bindir}/systemctl disable mdmonitor-takeover.service >/dev/null 2>&1 || :
|
||||||
|
|
||||||
|
# If there is any cron daemon configured, enable the systemd timer to avoid
|
||||||
|
# breaking the configuration silently when upgrading from 4.1-rc2.0.2 or
|
||||||
|
# earlier versions
|
||||||
|
%triggerin -- mdadm < 4.1-rc2.0.2
|
||||||
|
[ -e %{_sysconfdir}/crontab -o -e %{_sysconfdir}/anacrontab -o -e %{_sysconfdir}/fcrontab ] && %{_bindir}/systemctl enable raid-check.timer &>/dev/null || :
|
||||||
|
|
||||||
%preun
|
%preun
|
||||||
%systemd_preun mdmonitor.service
|
%systemd_preun mdmonitor.service raid-check.timer
|
||||||
|
|
||||||
%postun
|
%postun
|
||||||
%systemd_postun_with_restart mdmonitor.service
|
%systemd_postun_with_restart mdmonitor.service
|
||||||
@ -81,13 +89,15 @@ install -m644 %{SOURCE7} %{buildroot}/etc/libreport/events.d
|
|||||||
%{_unitdir}/*
|
%{_unitdir}/*
|
||||||
%{_mandir}/man*/md*
|
%{_mandir}/man*/md*
|
||||||
/usr/lib/systemd/system-shutdown/*
|
/usr/lib/systemd/system-shutdown/*
|
||||||
%config(noreplace) %{_sysconfdir}/cron.d/*
|
|
||||||
%config(noreplace) %{_sysconfdir}/sysconfig/*
|
%config(noreplace) %{_sysconfdir}/sysconfig/*
|
||||||
%dir /run/%{name}/
|
%dir /run/%{name}/
|
||||||
%config(noreplace) %{_tmpfilesdir}/%{name}.conf
|
%config(noreplace) %{_tmpfilesdir}/%{name}.conf
|
||||||
/etc/libreport/events.d/*
|
/etc/libreport/events.d/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Feb 09 2020 Alejandro Domínguez Muñoz <adomu@net-c.com> - 4.1-3
|
||||||
|
- Replace raid-check cron job with systemd timer
|
||||||
|
|
||||||
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 4.1-2
|
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 4.1-2
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
|
||||||
|
|
||||||
|
9
raid-check.service
Normal file
9
raid-check.service
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=RAID setup health check
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
ExecStart=/usr/sbin/raid-check
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
10
raid-check.timer
Normal file
10
raid-check.timer
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Weekly RAID setup health check
|
||||||
|
|
||||||
|
[Timer]
|
||||||
|
OnCalendar=Sun *-*-* 01:00:00
|
||||||
|
Persistent=true
|
||||||
|
AccuracySec=24h
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=timers.target
|
Loading…
Reference in New Issue
Block a user