summaryrefslogtreecommitdiff
path: root/package/utils/mdadm/files/mdadm.init
blob: 9da4684fb1ce5fe7d9214b9a18e2e4007ea24a2d (plain)
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
#!/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
}