blob: 4d5494a9a86913f4edc5717130e27d4c0fe951f5 (
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
#!/bin/sh
# script to manage nfs in a clustered environment
start_nfs() {
/bin/mkdir -p $CTDB_BASE/state/nfs
/bin/mkdir -p $CTDB_BASE/state/statd/ip
/bin/mkdir -p $STATD_SHARED_DIRECTORY
startstop_nfs stop
startstop_nfs start
}
reconfigure_nfs() {
# always restart the lockmanager so that we start with a clusterwide
# graceperiod when ip addresses has changed
[ -x $CTDB_BASE/statd-callout ] && {
$CTDB_BASE/statd-callout notify &
} >/dev/null 2>&1
}
. $CTDB_BASE/functions
service_name="nfs"
service_start="start_nfs"
service_stop="startstop_nfs stop"
service_reconfigure="reconfigure_nfs"
loadconfig
[ -z "$STATD_SHARED_DIRECTORY" ] && exit 0
ctdb_start_stop_service
case "$1" in
startup)
ctdb_service_start
;;
shutdown)
ctdb_service_stop
;;
takeip)
ctdb_service_set_reconfigure
touch $CTDB_BASE/state/statd/ip/$3
;;
releaseip)
ctdb_service_set_reconfigure
/bin/rm -f $CTDB_BASE/state/statd/ip/$3
;;
recovered)
# if we have taken or released any ips we must
# restart the lock manager so that we enter a clusterwide grace period
if ctdb_service_needs_reconfigure ; then
ctdb_service_reconfigure
fi
;;
monitor)
if ctdb_service_needs_reconfigure ; then
ctdb_service_reconfigure
exit 0
fi
# check that statd responds to rpc requests
# if statd is not running we try to restart it
rpcinfo -u localhost 100024 1 > /dev/null || {
RPCSTATDOPTS=""
[ -n "$STATD_HOSTNAME" ] && RPCSTATDOPTS="$RPCSTATDOPTS -n $STATD_HOSTNAME"
[ -n "$STATD_PORT" ] && RPCSTATDOPTS="$RPCSTATDOPTS -p $STATD_PORT"
[ -n "$STATD_OUTGOING_PORT" ] && RPCSTATDOPTS="$RPCSTATDOPTS -o $STATD_OUTGOING_PORT"
rpc.statd $RPCSTATDOPTS
echo "ERROR: STATD is not responding. Trying to restart it. [rpc.statd $RPCSTATDOPTS]"
}
# check that NFS responds to rpc requests
ctdb_check_rpc "NFS" 100003 3
# and that its directories are available
[ "$CTDB_NFS_SKIP_SHARE_CHECK" = "yes" ] || {
exportfs | grep -v '^#' | grep '^/' |
sed -e 's/[[:space:]]*[^[:space:]]*$//' |
ctdb_check_directories
} || exit $?
# check that lockd responds to rpc requests
ctdb_check_rpc "lockd" 100021 1
echo "$STATD_SHARED_DIRECTORY" | ctdb_check_directories "statd" || \
exit $?
# mount needs special handling since it is sometimes not started
# correctly on RHEL5
rpcinfo -u localhost 100005 1 > /dev/null || {
echo "ERROR: MOUNTD is not running. Trying to restart it."
RPCMOUNTDOPTS=""
[ -n "$MOUNTD_PORT" ] && RPCMOUNTDOPTS="$RPCMOUNTDOPTS -p $MOUNTD_PORT"
killall -q -9 rpc.mountd
rpc.mountd $RPCMOUNTDOPTS &
exit 1
}
;;
*)
ctdb_standard_event_handler "$@"
;;
esac
exit 0
|