On Tue, Dec 22, 2009 at 12:43:09AM +0800, Jiaju Zhang wrote:

[snip]

> +save_tcp_connections() {
> +     mydir=$OCF_RESKEY_tickle_dir/`hostname`
> +     rm -f $mydir/*
> +     netstat -tn |egrep 
> '^tcp[[:space:]]+[0-9]+[[:space:]]+[0-9]+[[:space:]]+[0-9\.]+:[0-9]+.*ESTABLISHED'
>  |
> +             awk '{print $4" "$5}' |
> +             while read server client; do
> +                     ip=${server%:*}
> +                     echo $client $server >> $mydir/$ip
> +             done
> +}


Can the filtering being done be egrep be rolled into the awk script?

> +
> +run_tickle_tcp() {
> +     for f in $OCF_RESKEY_tickle_dir/*/$OCF_RESKEY_ip; do
> +             [ -f $f ] && cat $f | while read client server; do
> +                     for i in `seq 1 3`; do
> +                             $TICKLETCP $client $server
> +                     done
> +             done
> +     done    
> +}
> +

Would it be worth allowing $TICKLETCP to tickle multiple connections
in a single invocation - for instance by reading $client $server from stdin?
I'm concerned about a situation where there are lots of connections,
it might take a while to spawn $TICKLETCP lots of times.

[snip]
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

Reply via email to