Blame SOURCES/0005-Monitor-add-system-timer-to-run-oneshot-periodically.patch

5d5466
From 7cd7e91ab3de5aa75dc963cb08b0618c1885cf0d Mon Sep 17 00:00:00 2001
5d5466
From: NeilBrown <neilb@suse.com>
5d5466
Date: Wed, 5 Dec 2018 16:35:00 +1100
5d5466
Subject: [RHEL7.7 PATCH 05/24] Monitor: add system timer to run --oneshot
5d5466
 periodically
5d5466
5d5466
"mdadm --monitor --oneshot" can be used to get a warning
5d5466
if there are any degraded arrays.  It can be helpful to get
5d5466
this warning periodically while the condition persists.
5d5466
5d5466
This patch add a systemd service and timer which can
5d5466
be enabled with
5d5466
   systemctl enable mdmonitor-oneshot.service
5d5466
5d5466
and will then provide daily warnings.
5d5466
5d5466
Signed-off-by: NeilBrown <neilb@suse.com>
5d5466
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
5d5466
---
5d5466
 Makefile                          |  1 +
5d5466
 systemd/mdmonitor-oneshot.service | 15 +++++++++++++++
5d5466
 systemd/mdmonitor-oneshot.timer   | 15 +++++++++++++++
5d5466
 3 files changed, 31 insertions(+)
5d5466
 create mode 100644 systemd/mdmonitor-oneshot.service
5d5466
 create mode 100644 systemd/mdmonitor-oneshot.timer
5d5466
5d5466
diff --git a/Makefile b/Makefile
5d5466
index afb62cc..dfe00b0 100644
5d5466
--- a/Makefile
5d5466
+++ b/Makefile
5d5466
@@ -279,6 +279,7 @@ install-systemd: systemd/mdmon@.service
5d5466
 		mdadm-last-resort@.service mdadm-grow-continue@.service \
5d5466
 		mdcheck_start.timer mdcheck_start.service \
5d5466
 		mdcheck_continue.timer mdcheck_continue.service \
5d5466
+		mdmonitor-oneshot.timer mdmonitor-oneshot.service \
5d5466
 		; \
5d5466
 	do sed -e 's,BINDIR,$(BINDIR),g' systemd/$$file > .install.tmp.2 && \
5d5466
 	   $(ECHO) $(INSTALL) -D -m 644 systemd/$$file $(DESTDIR)$(SYSTEMD_DIR)/$$file ; \
5d5466
diff --git a/systemd/mdmonitor-oneshot.service b/systemd/mdmonitor-oneshot.service
5d5466
new file mode 100644
5d5466
index 0000000..fd469b1
5d5466
--- /dev/null
5d5466
+++ b/systemd/mdmonitor-oneshot.service
5d5466
@@ -0,0 +1,15 @@
5d5466
+#  This file is part of mdadm.
5d5466
+#
5d5466
+#  mdadm is free software; you can redistribute it and/or modify it
5d5466
+#  under the terms of the GNU General Public License as published by
5d5466
+#  the Free Software Foundation; either version 2 of the License, or
5d5466
+#  (at your option) any later version.
5d5466
+
5d5466
+[Unit]
5d5466
+Description=Reminder for degraded MD arrays
5d5466
+
5d5466
+[Service]
5d5466
+Environment=  MDADM_MONITOR_ARGS=--scan
5d5466
+EnvironmentFile=-/run/sysconfig/mdadm
5d5466
+ExecStartPre=-/usr/lib/mdadm/mdadm_env.sh
5d5466
+ExecStart=BINDIR/mdadm --monitor --oneshot $MDADM_MONITOR_ARGS
5d5466
diff --git a/systemd/mdmonitor-oneshot.timer b/systemd/mdmonitor-oneshot.timer
5d5466
new file mode 100644
5d5466
index 0000000..cb54bda
5d5466
--- /dev/null
5d5466
+++ b/systemd/mdmonitor-oneshot.timer
5d5466
@@ -0,0 +1,15 @@
5d5466
+#  This file is part of mdadm.
5d5466
+#
5d5466
+#  mdadm is free software; you can redistribute it and/or modify it
5d5466
+#  under the terms of the GNU General Public License as published by
5d5466
+#  the Free Software Foundation; either version 2 of the License, or
5d5466
+#  (at your option) any later version.
5d5466
+
5d5466
+[Unit]
5d5466
+Description=Reminder for degraded MD arrays
5d5466
+
5d5466
+[Timer]
5d5466
+OnCalendar= 2:00:00
5d5466
+
5d5466
+[Install]
5d5466
+WantedBy= mdmonitor.service
5d5466
-- 
5d5466
2.7.5
5d5466