Re: Here's what I'm using
On Sat, Jan 22, 2000 at 11:05:18AM -0500, Tim Vanderhoek wrote: > On Fri, Jan 21, 2000 at 11:56:38PM -0700, Warner Losh wrote: > > > > arbitrary and works for me. I'm sure this could be improved, > > especially to make the order random. > > It really isn't too hard... I wouldn't be surprised if this > crosses another solution in email. :) It occurred to me that it would be a good and useful idea to weight the randomness such that certain favoured hosts have a greater chance of being the first host tried. This makes the script a little more useful (as opposed to just being a toy). Just change the multiplicative factor to increase the weighting factor. Order hosts in the set line from most to least favoured. As written, this gives cvsup7 and cvsup8 the greatest chance of being the first hosts tried. For even more fun, make this automatically keep a running track record of download speed and have it adjust the host weighting accordingly. #! /bin/sh if [ -z "$1" ] then set cvsup7.freebsd.org \ cvsup8.freebsd.org \ cvsup6.freebsd.org \ cvsup4.freebsd.org \ cvsup3.freebsd.org \ cvsup2.freebsd.org \ cvsup1.freebsd.org \ cvsup5.freebsd.org for n in `jot -r $#` do fairings="${fairings} $(($n - $# * 2)) $1" shift done hosts=`echo "$fairings" | sort -n | awk '{print $2}'` else hosts=$1 shift fi echo "Will try hosts $(echo $hosts)" for host in $hosts; do echo "Using host $host" for i in 1 2; do if cvsup -1 -P m -s -g ~/bin/sup/fbsd-supfile -L 2 -h $host $*; then exit; fi done done -- Signature withheld by request of author. To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-current" in the body of the message
Re: Here's what I'm using
On Fri, Jan 21, 2000 at 11:56:38PM -0700, Warner Losh wrote: > > arbitrary and works for me. I'm sure this could be improved, > especially to make the order random. It really isn't too hard... I wouldn't be surprised if this crosses another solution in email. :) #! /bin/sh if [ -z "$1" ]; then set cvsup7.freebsd.org \ cvsup8.freebsd.org \ cvsup6.freebsd.org \ cvsup4.freebsd.org \ cvsup3.freebsd.org \ cvsup2.freebsd.org \ cvsup1.freebsd.org \ cvsup5.freebsd.org for n in `jot -r $#` do fairings="${fairings} $n $1" shift done hosts=`echo "$fairings" | sort | awk '{print $2}'` else hosts=$1 shift fi echo "Will try hosts $(echo $hosts)" for host in $hosts; do echo "Using host $host" for i in 1 2; do if cvsup -1 -P m -s -g ~/bin/sup/fbsd-supfile -L 2 -h $host $*; then exit; fi done done -- Signature withheld by request of author. To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-current" in the body of the message
Here's what I'm using
OK. I said I'd clean this up and send this out. Well, I didn't get as much ceanup done as I'd have liked. The order of hosts is arbitrary and works for me. I'm sure this could be improved, especially to make the order random. Warner #!/bin/sh if [ -z "$1" ]; then hosts=" \ cvsup7.freebsd.org \ cvsup8.freebsd.org \ cvsup6.freebsd.org \ cvsup4.freebsd.org \ cvsup3.freebsd.org \ cvsup2.freebsd.org \ cvsup1.freebsd.org \ cvsup5.freebsd.org \ " else hosts=$1 shift fi echo "Will try hosts $hosts" for host in $hosts; do echo "Using host $host" for i in 1 2; do if cvsup -1 -P m -s -g ~/bin/sup/fbsd-supfile -L 2 -h $host $*; then exit; fi done done To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-current" in the body of the message