1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00
samba-mirror/ctdb/config/events.d/59.nfslock
Andrew Tridgell 76b7361c7e - added monitoring of rpc ports for nfs, and of Samba ports and directories
- added monitoring of the ethernet link state

When monitoring detects an error, the node loses its public IP address

(This used to be ctdb commit 0af57aead8c983511d25774b4ffe09fa5ff26501)
2007-06-06 12:08:42 +10:00

65 lines
1.3 KiB
Bash
Executable File

#!/bin/sh
# event strict to manage lockd and statd in a cluster environment
. /etc/ctdb/functions
loadconfig nfs
[ "$CTDB_MANAGES_NFSLOCK" = "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"
# make sure the service is stopped first
service nfslock stop > /dev/null 2>&1
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
;;
monitor)
# check that lockd responds to rpc requests
ctdb_check_rpc "statd" 100024 1
ctdb_check_rpc "lockd" 100021 1
ctdb_check_directories "statd" $STATD_SHARED_DIRECTORY
;;
esac
exit 0