Rev 619: more shell scripting fixes in 10.interface in http://samba.org/~tridge/ctdb

tridge at samba.org tridge at samba.org
Thu Sep 13 01:57:42 GMT 2007


------------------------------------------------------------
revno: 619
revision-id: tridge at samba.org-20070913015742-pvxju9jioih01sce
parent: tridge at samba.org-20070913011949-g2pwequzv7jvxpab
committer: Andrew Tridgell <tridge at samba.org>
branch nick: tridge.test2
timestamp: Thu 2007-09-13 11:57:42 +1000
message:
  more shell scripting fixes in 10.interface
modified:
  config/events.d/10.interface   10.interface-20070604050809-s21zslfirn07zjt8-1
=== modified file 'config/events.d/10.interface'
--- a/config/events.d/10.interface	2007-09-13 01:19:30 +0000
+++ b/config/events.d/10.interface	2007-09-13 01:57:42 +0000
@@ -25,8 +25,10 @@
 kill_tcp_connections() {
     _IP="$1"    
     _failed=0
+
     _killcount=0
-    netstat -tn |egrep "^tcp.*\s+$_IP:.*ESTABLISHED" | awk '{print $4" "$5}' | 
+    connfile="/etc/ctdb/state/connections.$_IP"
+    netstat -tn |egrep "^tcp.*\s+$_IP:.*ESTABLISHED" | awk '{print $4" "$5}' > $connfile
     while read dest src; do
 	srcip=`echo $src | cut -d: -f1`
 	srcport=`echo $src | cut -d: -f2`
@@ -34,11 +36,15 @@
 	destport=`echo $dest | cut -d: -f2`
 	ctdb killtcp $srcip:$srcport $destip:$destport >/dev/null 2>&1 || _failed=1
 	_killcount=`expr $_killcount + 1`
-    done
+    done < $connfile
+    /bin/rm -f $connfile
     [ $_failed = 0 ] || {
 	echo "`date` Failed to send killtcp control"
 	return;
     }
+    [ $_killcount -gt 0 ] || {
+	return;
+    }
     _count=0
     while netstat -tn |egrep "^tcp.*\s+$_IP:.*ESTABLISHED" > /dev/null; do
 	sleep 1



More information about the samba-cvs mailing list