1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00
samba-mirror/ctdb/config/statd-callout
Andrew Tridgell e763874872 make the init scripts more portable about location of system config files
(This used to be ctdb commit 65f3e2bc722e314b2c51c3bfdc544b408a8a64cf)
2007-06-03 22:07:07 +10:00

47 lines
1.4 KiB
Bash
Executable File

#!/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