Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 182839
Collapse All | Expand All

(-)etc.orig/rc.d/init.d/raidmon (-44 / +36 lines)
Lines 1-54 Link Here
1
#!/bin/sh
1
#!/sbin/runscript
2
#
3
# chkconfig: 2345 20 80
4
# description: RAIDMon is a daemon that monitors the RAID subsystem
2
# description: RAIDMon is a daemon that monitors the RAID subsystem
5
#               And generates e-mail to root
3
#               And generates e-mail to root
6
# processname: MegaServ.
4
# processname: MegaServ.
7
5
8
# source function library
9
. /etc/rc.d/init.d/functions
10
6
11
case "$1" in
7
depend() {
12
  start)
8
	use logger
13
	megadevice="megadev0"
9
	need net
14
        rm -f /dev/$megadevice 2>/dev/null
10
}
15
        megamajor=`cat /proc/devices|gawk '/megadev/{print$1}' `
11
16
        mknod /dev/$megadevice c $megamajor 0 2>/dev/null
12
checkconfig() {
17
	# New check : Timir: 10-31-01: Does node exist
13
	if [[ $( grep -v "^#" /etc/megamon.conf ) == "" ]]; then
18
	if [ ! -c /dev/$megadevice ]
14
		ewarn "WARNING: /etc/megamon.conf has not been configured"
19
	then
20
	  echo " 
21
		Character Device Node /dev/$megadevice does not exist.
22
	  	Raid Monitor could not be started
23
		"
24
	  exit 1
25
	fi
15
	fi
16
}
26
17
27
	#echo -n 'Starting NetRAID Monitor:'
18
start() {
28
	echo -n 'Starting RAID Monitor:'
19
	checkconfig        
29
	daemon MegaCtrl -start
20
	
21
	megadevice="megadev0"
22
	rm -f /dev/$megadevice 2>/dev/null
23
	megamajor=`cat /proc/devices|gawk '/megadev/{print$1}' `
24
	mknod /dev/$megadevice c $megamajor 0 2>/dev/null
25
        # New check : Timir: 10-31-01: Does node exist
26
	if [ ! -c /dev/$megadevice ] ; then
27
		eerror "Character Device Node /dev/$megadevice does not exist."
28
		eerror "Raid Monitor could not be started"
29
		return 1
30
        fi
31
	
32
	ebegin "Starting RAID Monitor"
33
	start-stop-daemon --start --background --exec /usr/sbin/MegaCtrl -- -start
30
	touch /var/lock/subsys/raidmon
34
	touch /var/lock/subsys/raidmon
31
    echo
35
	eend $?
32
	;;
36
}
33
  stop)
37
34
	#echo -n 'Stopping NetRAID Monitor:'
38
stop() {
35
	echo -n 'Stopping RAID Monitor:'
39
	ebegin "Stopping RAID Monitor"
36
	daemon MegaCtrl -stop
40
	
37
	megadevice="megadev0"
41
	megadevice="megadev0"
38
        rm -f /dev/$megadevice 2>/dev/null
42
	start-stop-daemon --stop --name MegaServ --exec /usr/sbin/MegaCtrl -- -stop
43
	rm -f /dev/$megadevice 2>/dev/null
39
	rm -f /var/lock/subsys/raidmon 2>/dev/null
44
	rm -f /var/lock/subsys/raidmon 2>/dev/null
40
    echo
45
	eend $?
41
	;;
46
}
42
  restart|reload)
43
	$0 stop
44
	$0 start
45
	;;
46
  *)
47
	#echo "NetRAID Monitor is not Started/Stopped"
48
	echo "RAID Monitor is not Started/Stopped"
49
        echo "Usage: raidmon {start|stop|restart}"
50
	exit 1
51
esac
52
53
exit 0
54

Return to bug 182839