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

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