aboutsummaryrefslogtreecommitdiffstats
path: root/package/utils/mdadm/files
diff options
context:
space:
mode:
authorDaniel Dickinson <openwrt@daniel.thecshore.com>2015-10-15 06:23:26 -0400
committerJo-Philipp Wich <jo@mein.io>2016-05-18 22:17:28 +0200
commit3e08637e878c32a40cdcb84c6030fcdd0cb88196 (patch)
tree480ba0f2b6593c3cc5989d5e8d2639100713dc69 /package/utils/mdadm/files
parent3015af96475ad135ecb55b7c1f794191e3d4a587 (diff)
downloadupstream-3e08637e878c32a40cdcb84c6030fcdd0cb88196.tar.gz
upstream-3e08637e878c32a40cdcb84c6030fcdd0cb88196.tar.bz2
upstream-3e08637e878c32a40cdcb84c6030fcdd0cb88196.zip
mdadm: Fix missing conffile and add initscript
Start arrays on boot, stop them on shutdown, and enable monitoring to syslog. Signed-off-by: Daniel Dickinson <openwrt@daniel.thecshore.com>
Diffstat (limited to 'package/utils/mdadm/files')
-rw-r--r--package/utils/mdadm/files/mdadm.config3
-rw-r--r--package/utils/mdadm/files/mdadm.init34
2 files changed, 37 insertions, 0 deletions
diff --git a/package/utils/mdadm/files/mdadm.config b/package/utils/mdadm/files/mdadm.config
new file mode 100644
index 0000000000..536228fae4
--- /dev/null
+++ b/package/utils/mdadm/files/mdadm.config
@@ -0,0 +1,3 @@
+config mdadm
+ option email root
+
diff --git a/package/utils/mdadm/files/mdadm.init b/package/utils/mdadm/files/mdadm.init
new file mode 100644
index 0000000000..9da4684fb1
--- /dev/null
+++ b/package/utils/mdadm/files/mdadm.init
@@ -0,0 +1,34 @@
+#!/bin/sh /etc/rc.common
+
+START=13
+STOP=98
+
+USE_PROCD=1
+PROG=/sbin/mdadm
+NAME=mdadm
+
+mdadm_email() {
+ local cfg="$1"
+ if [ ! -x /sbin/sendmail ]; then
+ return
+ fi
+ config_get email "$cfg" email
+}
+
+start_service() {
+ local email
+
+ config_load mdadm
+ config_foreach mdadm_email mdadm
+
+ $PROG --assemble --scan
+
+ procd_open_instance
+ procd_set_param command "$PROG" --monitor ${email:+--mail=$email} --syslog --scan
+ procd_close_instance
+}
+
+stop_service() {
+ $PROG --stop --scan
+}
+