 3e08637e87
			
		
	
	3e08637e87
	
	
	
		
			
			Start arrays on boot, stop them on shutdown, and enable monitoring to syslog. Signed-off-by: Daniel Dickinson <openwrt@daniel.thecshore.com>
		
			
				
	
	
		
			35 lines
		
	
	
		
			480 B
		
	
	
	
		
			Bash
		
	
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
		
			480 B
		
	
	
	
		
			Bash
		
	
	
	
	
	
| #!/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
 | |
| }
 | |
| 
 |