From dad5d3a7463890ac6b631eb7fd656166e8015716 Mon Sep 17 00:00:00 2001
From: Greg Frost <gregfrost1@bigpond.com>
Date: Thu, 2 Jul 2009 19:19:20 +0930
Subject: runit-scripts: add mdadm/run mdadm/finish

---
 abs/core-testing/runit-scripts/PKGBUILD               |  2 +-
 .../runit-scripts/runitscripts/services/mdadm/finish  | 17 +++++++++++++++++
 .../runit-scripts/runitscripts/services/mdadm/run     | 19 +++++++++++++++++++
 3 files changed, 37 insertions(+), 1 deletion(-)
 create mode 100755 abs/core-testing/runit-scripts/runitscripts/services/mdadm/finish
 create mode 100755 abs/core-testing/runit-scripts/runitscripts/services/mdadm/run

diff --git a/abs/core-testing/runit-scripts/PKGBUILD b/abs/core-testing/runit-scripts/PKGBUILD
index 3d9c25a..2c237d7 100755
--- a/abs/core-testing/runit-scripts/PKGBUILD
+++ b/abs/core-testing/runit-scripts/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=runit-scripts
 pkgver=1.8.0
-pkgrel=89
+pkgrel=90
 pkgdesc="collection of startup scripts for runit"
 url="http://smarden.org/runit/"
 license="BSD"
diff --git a/abs/core-testing/runit-scripts/runitscripts/services/mdadm/finish b/abs/core-testing/runit-scripts/runitscripts/services/mdadm/finish
new file mode 100755
index 0000000..92782ba
--- /dev/null
+++ b/abs/core-testing/runit-scripts/runitscripts/services/mdadm/finish
@@ -0,0 +1,17 @@
+#!/bin/bash
+#
+# Stop Monitoring software raid arrays
+exec 2>&1
+export TERM=linux
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`pidof -o %PPID /sbin/mdadm`
+    stat_runit "Stopping mdadm RAID Monitor"
+    [ ! -z "$PID" ] && kill $PID &>/dev/null
+    if [ $? -gt 0 ]; then
+      stat_fail
+    else
+      rm_daemon mdadm
+      stat_done
+    fi
diff --git a/abs/core-testing/runit-scripts/runitscripts/services/mdadm/run b/abs/core-testing/runit-scripts/runitscripts/services/mdadm/run
new file mode 100755
index 0000000..0ab432e
--- /dev/null
+++ b/abs/core-testing/runit-scripts/runitscripts/services/mdadm/run
@@ -0,0 +1,19 @@
+#!/bin/bash
+#
+# Start Monitoring software raid arrays
+exec 2>&1
+export TERM=linux
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`pidof -o %PPID /sbin/mdadm`
+    stat_runit "Starting mdadm RAID Monitor"
+    if [ -z "$PID" ]; then
+       /sbin/mdadm -F -s
+    fi
+    if [ ! -z "$PID" -o $? -gt 0 ]; then
+      stat_fail
+    else
+      add_daemon mdadm
+      stat_done
+    fi
-- 
cgit v0.12

