-
Notifications
You must be signed in to change notification settings - Fork 57
/
rc.mdraid
executable file
·45 lines (37 loc) · 998 Bytes
/
rc.mdraid
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#! /bin/sh
source /etc/rc.d/common
MDADM="/sbin/mdadm"
DFLT_OPTS="--assemble --scan"
check_args ${@}
SCRIPT="$(/usr/bin/basename ${0})"
if check_opts_set ${SCRIPT}; then
USER_OPTS="$(get_rc_opts ${SCRIPT})"
if [ ${?} -ne 0 ]; then
/bin/echo ${USER_OPTS}
exit 1
fi
else
USER_OPTS="${DFLT_OPTS}"
fi
start() {
/bin/echo "Assembling software RAID devices..."
eval ${MDADM} ${USER_OPTS} || exit 1
}
stop() {
/bin/echo "Stopping MD RAID arrays..."
${MDADM} --detail --scan | while read -r row; do
md_path="$(echo ${row} | awk '{ print $2 }')"
md_name="$(echo ${row} | awk '{ print $4 }' | \
cut -d= -f2 | cut -d: -f2)"
# Only stop arrays that aren't the ESOS boot media
if ! echo ${md_name} | egrep 'boot|root|conf|logs' > /dev/null; then
${MDADM} --stop ${md_path} || exit 1
fi
done
}
status() {
# We don't know anything
exit ${UNKNOWN}
}
# Perform specified action
${1}