Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I often use rsync on a OSX-based laptop to synchronise some files from it to a Linux server. The laptop can be connected to different networks with greatly varying bandwidths (office ethernet, wifi, 3G, etc.) The --bwlimit=Kbps option allows one to control the bandwidth used in userspace by specifying a hard (well, approximately hard) limit to rsync itself. However, it's expressed in Kbps, which makes it difficult for use in automated scripts that get used on varying networks, such as the ones the laptop connects to.

Is there a way to tell rsync to use a percentage of the bandwidth rather than a limit expressed in K? Alternatively, can I easily calculate this value dynamically or wrap rsync with a script to do it?

I'd like a solution that works on OS X, or failing that Linux - ideally both.

Note: I'd like to avoid solutions that involve hardcore traffic shaping with a firewall or such. Approximate or estimated values for the limit are OK.

share|improve this question
1  
How do you intend to establish the maximum theoretical bandwidth in order to determine the percentage? Can you please give more color/detail on what you're really trying do? What is the portable device? –  ewwhite Jun 2 '13 at 18:33
    
@ewwhite, The portable device is typically a MacBook (although it might be other laptops). How do I intend to establish it - well, that's really the crux of the question. –  Andrew Ferrier Jun 2 '13 at 19:32
    
What is your goal, though? What are you trying to do with the laptop? –  ewwhite Jun 2 '13 at 19:34
    
I've added some detail. Hopefully that clarifies. –  Andrew Ferrier Jun 2 '13 at 19:35
    
A solution that involves a feature in Rsync. How about grabbing the source code for rsync and submitting a patch? –  Magellan Jun 3 '13 at 5:45
add comment

1 Answer

Assuming you have Python, you could modify speedtest-cli to change its printed results, or import it as a module into your own program and use the return values of its downloadSpeed() function. As is, you can get:

$ ./speedtest-cli --simple
Ping: 375.668 ms
Download: 66.36 Mbit/s
Upload: 41.05 Mbit/s
share|improve this answer
    
Thanks, that's a great idea. This does only test the internet bandwidth though (i.e. to the speedtest.net servers), which is constrained by connectivity to the internet. I was looking for something for a local network, where speed of the raw network interface was more the factor. It's a start, though. –  Andrew Ferrier Jun 2 '13 at 19:31
1  
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.