blob: 3f645ec732ef1f2b348af0614a44223ffc864c3a (
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
|
#!/bin/sh
# this script needs to be installed so that statd points to it with the -H
# command line argument. The easiest way to do that is to put something like this in
# /etc/sysconfig/nfs:
# STATD_HOSTNAME="myhostname -H /etc/ctdb/statd-callout"
. /etc/ctdb/functions
loadconfig nfs
[ -z "$STATD_SHARED_DIRECTORY" ] && exit 0
[ -d $STATD_SHARED_DIRECTORY ] || exit 0
case "$1" in
add-client)
for f in `/bin/ls /etc/ctdb/state/statd/ip/*`; do
ip=`/bin/basename $f`
[ -d $STATD_SHARED_DIRECTORY/$ip ] || /bin/mkdir $STATD_SHARED_DIRECTORY/$ip
/bin/touch $STATD_SHARED_DIRECTORY/$ip/sm/$2
done
;;
del-client)
for f in `/bin/ls /etc/ctdb/state/statd/ip/*`; do
ip=`/bin/basename $f`
/bin/rm -f $STATD_SHARED_DIRECTORY/$ip/sm/$2
done
;;
notify)
# restart the local lock manager and statd
/etc/init.d/nfslock stop > /dev/null 2>&1
/etc/init.d/nfslock start > /dev/null 2>&1
# send out notifications to any additional ips we now serve
for f in `/bin/ls /etc/ctdb/state/statd/ip/*`; do
ip=`/bin/basename $f`
[ -d $STATD_SHARED_DIRECTORY/$ip ] && {
# we must copy to a different directory since rpc.statd gets
# "upset" if sm-notify touches the files.
/bin/rm -rf /tmp/statd/$ip
/bin/mkdir -p /tmp/statd/$ip
/bin/cp -apr $STATD_SHARED_DIRECTORY/$ip/* /tmp/statd/$ip
[ -x /usr/sbin/sm-notify ] && /usr/sbin/sm-notify -P /tmp/statd/$ip -v $ip -n
}
done
;;
esac
|