dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

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

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