2 # script to manage nfs in a clustered environment
4 [ -n "$CTDB_BASE" ] || \
5 export CTDB_BASE=$(cd -P $(dirname "$0") ; dirname "$PWD")
14 set_proc "sys/net/ipv4/tcp_tw_recycle" 1
20 service_reconfigure ()
22 # if the ips have been reallocated, we must restart the lockmanager
23 # across all nodes and ping all statd listeners
24 [ -x $CTDB_BASE/statd-callout ] && {
25 $CTDB_BASE/statd-callout notify &
31 [ "$NFS_SERVER_MODE" != "ganesha" ] || exit 0
33 ctdb_setup_service_state_dir
35 statd_update_trigger="$service_state_dir/update-trigger"
36 # We want this file to always exist. The corner case is when
37 # auto-start/stop is switched off, NFS is added as a managed service
38 # some time after ctdbd is started and someone else starts the NFS
39 # service for us. In this case this file might not otherwise exist
40 # when we get to a monitor event.
41 touch "$statd_update_trigger"
43 ctdb_start_stop_service
45 is_ctdb_managed_service || exit 0
47 ctdb_service_check_reconfigure
51 # read statd from persistent database
62 ctdb_service_set_reconfigure
66 ctdb_service_set_reconfigure
70 # Check that directories for shares actually exist.
71 [ "$CTDB_NFS_SKIP_SHARE_CHECK" = "yes" ] || {
72 exportfs -v | grep '^/' |
73 sed -r -e 's@[[:space:]]+[^[:space:]()]+\([^[:space:]()]+\)$@@' |
75 ctdb_check_directories
80 nfs_check_rpc_services
82 # once every 600 seconds, update the statd state database for which
83 # clients need notifications
84 LAST_UPDATE=`stat --printf="%Y" "$statd_update_trigger"`
85 CURRENT_TIME=`date +"%s"`
86 [ $CURRENT_TIME -ge $(($LAST_UPDATE + 600)) ] && {
87 touch "$statd_update_trigger"
88 $CTDB_BASE/statd-callout updatelocal &
89 $CTDB_BASE/statd-callout updateremote &
94 ctdb_standard_event_handler "$@"