Q: limit bandwidth by process I have server that runs a backup process (a bash script, actually) every hour. Part of this backup routine is to sync changes to a remote system (includes revision control, etc etc).  This works  great, takes almost no CPU or memory and is the perfect backup solution for this system.
However, the problem is that it exists on a very limited outbound bandwidth, and every hour the script locks up the system for 30-90 seconds (depending on how much needs to be synced up).  It gets so bad that even when I'm using an SSH connection during the backup timeframe the terminal connection will lock up and take 5+ seconds to respond for every keystroke.
The Question: How can I limit the outbound bandwidth on a per-process, per-program, or per-script basis?  If it makes a difference, I use Ubuntu server.  Are there any utilities out that do this?
For extra credit, are there any C/C++ references on binding/owning network connections that I can use to create my own program?  For example: Apache grabs port 80, but whenever it tries to send something out, my program would jump in and throttle the connection, in-between apache and the hardware-level network interface.  Is this even possible?
(Note: I am willing to consider options that modify the linux kernel, but only if there is nothing else available).

A: you should try  http://monkey.org/~marius/pages/?page=trickle ( light userspace bandwith limiting tool ) and http://klicman.org/throttle/ ( a bandwidth limiting pipe ) , seems to be what you need .

A: Check out nice, ionice, and http://stromberg.dnsalias.org/~strombrg/slowdown/
You could also look into a traffic shaping router on the network side.
If your backup program doesn't already do incrementals, compression and deduplication, you might want to look into that as well, to reduce the amount of bandwidth being pushed by the backup process(es).
