summaryrefslogtreecommitdiff
blob: 48d660b1dcb701cf1baf2b415631624d20bc4bfc (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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/sbin/runscript
# Parts taken from lm_sensors package

depend() {
	need vprocunhide
}

start(){ 
	if ! [ -f /etc/conf.d/vservers ] ; then
        	eerror "/etc/conf.d/vservers does not exist, nothing to do"
		return 1
        fi
	. /etc/conf.d/lm_sensors
  	

	if [ -z "${MARK_0}" ] ; then
		eerror "MARK_0 is not set in /etc/conf.d/vservers, nothing to do"
		return 1
	fi

	einfo "Launching vservers..."

	i=0
	while true; do
		mark=`eval echo '$'MARK_${i}`
		if [ -z "${mark}" ] ; then
			break
		fi
		ebegin "  Starting vservers with mark ${mark}"
		export MARK=${mark}
		/usr/lib/util-vserver/vserver-wrapper start
		eend $?
		i=$((i+1))
        done
}


stop() {
	if ! [ -f /etc/conf.d/vservers ] ; then
		eerror "/etc/conf.d/vservers does not exist, nothing to do"
		return 1
	fi

	. /etc/conf.d/lm_sensors
  	

	if [ -z "${MARK_0}" ] ; then
		eerror "MARK_0 is not set in /etc/conf.d/vservers, nothing to do"
		return 1
	fi

	einfo "Stopping vservers..."

	# we determine the number of vserver marks
	i=0
		while true; do
		mark=`eval echo '$'MARK_${i}`
		if [ -z "${mark}" ] ; then
			break
		fi
		i=$((i+1))
		done


		i=$((i-1))

		while true; do
			mark=`eval echo '$'MARK_${i}`
			if [ -z "${mark}" ] ; then
				break
			fi
			ebegin "  Stopping vservers with mark ${mark}"
			export MARK=${mark}
			/usr/lib/util-vserver/vserver-wrapper stop
				eend $?
			if [ "0" -eq "${i}" ] ; then
				break
			fi
			i=$((i-1))
		done
}