ethtool does not support virtio_net devices.
[Samba.git] / ctdb / config / events.d / 61.nfstickle
blobdeb796650a85ca352d88095fb9d0b7ba9dd1212b
1 #!/bin/sh
2 # ctdb event script for NFS tickle acks
4 . $CTDB_BASE/functions
6 service_name="nfs"
8 loadconfig
10 service_start="mkdir -p $CTDB_BASE/state/nfstickle;mkdir -p $NFS_TICKLE_SHARED_DIRECTORY/`hostname`;echo 1 > /proc/sys/net/ipv4/tcp_tw_recycle"
11 service_reconfigure=$service_start
13 ctdb_start_stop_service
15 [ -z "$NFS_TICKLE_SHARED_DIRECTORY" ] && exit 0
17 case "$1" in
18 startup)
19 ctdb_service_start
22 takeip)
23 iface=$2
24 ip=$3
25 # first send a grat arp, to ensure the client knows the updated
26 # mac address for this IP
27 ctdb gratiousarp $ip $iface
28 # send tickle acks for all the connections the old server had
29 for f in $NFS_TICKLE_SHARED_DIRECTORY/*/$ip; do
30 [ -f $f ] && cat $f | while read dest; do
31 # send three, in case of lost packets
32 echo "Sending NFS tickle ack for $ip to $dest"
33 for i in `seq 1 3`; do
34 ctdb tickle $dest $ip:2049
35 done
36 done
37 done
40 monitor)
41 mydir=$NFS_TICKLE_SHARED_DIRECTORY/`hostname`
42 rm -f $mydir/*
43 # record our connections to shared storage
44 netstat -tn |egrep '^tcp[[:space:]]+[0-9]+[[:space:]]+[0-9]+[[:space:]]+[0-9\.]+:2049.*ESTABLISHED' |
45 awk '{print $4" "$5}' |
46 while read dest src; do
47 ip=${dest%:*}
48 echo $src >> $mydir/$ip
49 done
53 ctdb_standard_event_handler "$@"
55 esac
57 exit 0