Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I sometimes connect my Ubuntu laptop to my phone's 3G connection via tethering. When connected to that network I don't want Dropbox to synchronize as I have a limited data plan. I do want it synchronize when connected to my work or home Wifi.

I am looking for a clean yet easy solution in linux and more specifically Ubuntu. A more sophisticated solution that would actually place caps on the bandwidth for Dropbox when connected to certain wifi ESSIDs is also desirable.

share|improve this question
1  
Here's a possible start. Dropbox uses port 443 (SSL). You won't want to block this port. So blocking the destination is an option. Here are the destination IP's 199.47.216.0/22 108.160.160.0/20 205.189.0.0/24 What you want to do is create a script that when SSID = X, or when my public IP = aaa.bbb.ccc.ddd, block the following IP's. At least that's the idea I have for the moment. –  Everett Aug 8 '12 at 3:52
1  
I don't want to use static IP addresses. I was thinking more about a solution that would recognize the Dropbox daemon instead of the target of the communication. –  smichak Aug 8 '12 at 4:00
1  
You're not using static IP's, you are blocking the connection to DropBoxes IP's. It's the only way that you would be able to throttle traffic FYI (throttle instead of block). However, it sounds like you want a script that says when SSID = X, kill Dropbox Daemon. –  Everett Aug 8 '12 at 4:03
add comment

1 Answer

up vote 9 down vote accepted

Instead of blocking dropbox, you could simply stop it when you are connected to the network in question (you don't need dropbox running to access locally synchronised files)

For example, placing the following in /etc/network/if-up.d/ will make it run after a network connection is established:

#!/bin/bash
ifconfig -a | grep -q "192\.168\.0\." && killall dropboxd

This will kill (gracefully) the dropbox daemon when you connect to a network that give you an ip address in the 192.168.0.* range. If you can determine something that will identify your 3G network after connecting, then you can simply stop dropbox when you connect. You could extend this script to start dropbox when connecting to other networks.

share|improve this answer
    
Good going Paul! +1 –  Everett Aug 8 '12 at 4:15
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.