blob: 033884a35626cd90f65cbd7e36d6c81b6566099c (
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
84
85
|
#!/sbin/runscript
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License, v2 or later
# $Header: /var/cvsroot/gentoo-x86/sys-cluster/drbd/files/drbd-0.7-init,v 1.3 2005/03/01 12:11:40 xmerlin Exp $
opts="${opts} reload"
DRBDADM="/sbin/drbdadm"
PROC_DRBD="/proc/drbd"
MODPROBE="modprobe"
RMMOD="rmmod"
ADD_MOD_PARAM=""
depend() {
use logger
before heartbeat
after sshd
need net
}
create_devices() {
local RESOURCES RESOURCE DEVICE
# create dev if needed
RESOURCES=`$DRBDADM sh-resources`
#RESOURCES=${RESOURCE%%\ *}
for RESOURCE in $RESOURCES; do
DEVICE=`$DRBDADM sh-dev $RESOURCE`
if [ ! -f ${DEVICE} ]; then
mknod $DEVICE b 147 ${RESOURCE/drbd/}
fi
done
}
load_module() {
if [ ! -f $PROC_DRBD ]; then
${MODPROBE} -s drbd `$DRBDADM sh-mod-parms` $ADD_MOD_PARAM &> /dev/null
fi
}
start() {
ebegin "Starting DRBD"
load_module
create_devices
${DRBDADM} up all
eend $ret
}
stop() {
ebegin "Stopping DRBD"
# Check for mounted drbd devices
if ! grep -q '^/dev/drbd' /proc/mounts &>/dev/null; then
if [ -f $PROC_DRBD ]; then
${DRBDADM} down all
fi
eend $?
else
einfo "drbd devices mounted, please umount them before trying to stop drbd!!!"
eend 1
fi
}
status() {
# NEEDS to be heartbeat friendly...
# so: put some "OK" in the output.
ebegin "Status of DRBD"
if [ -e $PROC_DRBD ]; then
echo "drbd driver OK; device status:"
cat "$PROC_DRBD"
eend 0
else
echo >&2 "drbd not loaded"
eend 3
fi
}
reload() {
ebegin "Reloading DRBD"
${DRBDADM} adjust all
eend $?
}
|