1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-14 19:24:43 +03:00

56 lines
1.1 KiB
Plaintext
Raw Normal View History

#!/bin/sh
# event strict to manage lockd and statd in a cluster environment
. /etc/sysconfig/nfs
. /etc/ctdb/functions
[ -z $CTDB_MANAGES_NFS ] && exit 0
[ $CTDB_MANAGES_NFS != "yes" ] && exit 0
[ -z "$STATD_SHARED_DIRECTORY" ] && exit 0
cmd="$1"
shift
case $cmd in
startup)
/bin/mkdir -p /etc/ctdb/state/statd/ip
ctdb_wait_directories "nfslock" "$STATD_SHARED_DIRECTORY"
service nfslock start
;;
shutdown)
service nfslock stop
;;
takeip)
ip=$2
echo $ip >> /etc/ctdb/state/statd/restart
# having a list of what IPs we have allows statd to do the right
# thing via /etc/ctdb/statd-callout
/bin/touch /etc/ctdb/state/statd/ip/$ip
;;
releaseip)
ip=$2
echo $ip >> /etc/ctdb/state/statd/restart
/bin/rm -f /etc/ctdb/state/statd/ip/$ip
;;
recovered)
# if we have taken or released any ips we must send out
# statd notifications to recover lost nfs locks
[ -x /etc/ctdb/statd-callout ] && [ -f /etc/ctdb/state/statd/restart ] && {
/etc/ctdb/statd-callout notify &
} >/dev/null 2>&1
/bin/rm -f /etc/ctdb/state/statd/restart
;;
esac
exit 0