1

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.

Andrew Ferrier
  • 894
  • 9
  • 21
  • 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 02 '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 02 '13 at 19:32
  • What is your goal, though? What are you trying to do with the laptop? – ewwhite Jun 02 '13 at 19:34
  • I've added some detail. Hopefully that clarifies. – Andrew Ferrier Jun 02 '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 03 '13 at 05:45

1 Answers1

1

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
Mike Renfro
  • 1,301
  • 1
  • 8
  • 11
  • 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 02 '13 at 19:31
  • 1
    http://apple.stackexchange.com/questions/44537/ethtool-equivalent-for-os-x-lion – dmourati Jun 03 '13 at 03:20