Linux – real time backup if file changed

backuplinuxreal timesuse

Are there any linux/unix console applications similar to Yadis that would allow me to:

  • be set up from the console
  • backup multiple directories
  • backup / sync in real time after the files (text files) are changed

Update 1:

I write shell scripts, ruby scripts, aliases etc etc to make my work easier. I want to have backup of these files. The solution I am looking for will copy these files after any change was made to them to a subdirectory of my dropbox directory and that's it. Backup is done and available from anywhere. Always fresh and ready and I don't have to think about it.

I know I can run cron few times a day but I thought there must be a solution for what I am looking for available on linux. I am not so linux experienced so I asked here.

Best Answer

You could probably hack this together using inotify and more specifically incron to get notifications of file system events and trigger a backup.

Meanwhile, in order to find a more specific solution you might try to better define your problem.

  • If your problem is backup, it might be good to use a tool that is made to create snapshots of file systems, either through rsnap or a snapshoting file system like xfs or using any file system with lvm.
  • If your problem is sycronizing, perhaps you should look into distributed and/or netowrk file systems.

Edit: In light of your update, I think you are making this way to complicated. Just make a folder in your dropbox for scripts. Then in your bashrc files do something like this:

export PATH=$PATH:~/Dropbox/bin
source ~/Dropbox/bashrc

Whatever scripts you have can be run right from the dropbox folder in your home directory, and any aliases and such you want synced can go in a file inside Dropbox that gets sourced by your shell.

If other people besides you need access to the scripts, you could symlink them from your Dropbox to somewhere like /usr/local/bin.

Related Question