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 using my Dropbox to sync my config files on different machines. In addition my Dropbox is synced with encfs. encfs mounts a volume with the decrypted Dropbox-folder on startup. This process takes a while. This is not a problem for config files like .vimrc or .bashrc or something because I am not using this programs directly during startup. I just use a simple

cd && ln -s DecryptedDropbox/.vimrc

to link them. And .vimrc is available as soon as the decrypted Dropbox is mounted.

However, I use some config files which are important for the startup process like config files for my windowmanager i.e. .i3/.

Would it be possible to local version of .i3 on my hard drive that syncs with Dropbox as soon as it is available? Of course I also want the Dropbox version changed if I change the local version. I think hard links would not work here since there not really to copys of my file, right? Any other ideas? rsync?

share|improve this question
    
So, your problem is that Dropbox isn't starting up soon enough and sync'ing your config files soon enough? (soon enough for your window manager?) –  dtmland Jul 9 '13 at 18:34
add comment

2 Answers 2

up vote 1 down vote accepted
+50

Files in the dropbox folder are real files. You should be able to hard link them, but it might not be the best way of doing things. If the files are very small then a simple cron script to copy them once every few minutes might be the simplest and most robust solution here.

share|improve this answer
    
Last I checked, Dropbox's file-change algorithm didn't notice changes to files that are hard linked both in and out of the Dropbox directory. –  killermist Jul 15 '13 at 23:30
add comment

A few options:

  1. Keeping Dropbox: The easiest solution would be to keep these files in a non-encrypted part of your Dropbox, I assume there is no reason to have your WM config files encrypted. You can then just do a simple soft link as you describe for .vimrc. If it is the encryption that is causing you problems, that should fix it.

    If you are committed to using Dropbox and can't have any part of it unencrypted, I don't see how you could combine it with rsync. As far as I know Dropbox does not offer any ssh or other access, only its own client.

  2. Ditching Dropbox: If, on the other hand, you don't need to use Dropbox but just want to copy certain configuration files from a remote server only if those files are newer than the local copies, yes you can use rsync. If you have passwordless ssh access set up between the server and the local machine, you should be able to copy the relevant files with this command:

    rsync -uza user@remote.com:/home/user/.ie3/ .ie3/

    Note the slash at the end of each directory, that tells rsync to copy the directories' content and not the folders themselves. This is so you don't end up with a local ~/.ie3/.ie3/.

    From man rsync:

    -u, --update
      This  forces  rsync to skip any files which exist on the destination and
      have a modified time that is newer than the source file.  (If an existing
      destination file has a modification  time  equal  to  the source file’s, 
      it will be updated if the sizes are different.)
    
    -z, --compress
      With  this  option,  rsync  compresses the file data as it is sent to the 
      destination machine, which reduces the amount of data being transmitted --
      something that is useful over a slow connection.
    
    -a, --archive <- this preserves mod. times, permissions etc.
      This is equivalent to -rlptgoD. It is a quick way of saying you want 
      recursion and want to preserve almost everything.
    
share|improve this answer
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.