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

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