Today I decided to free myself from my Dropbox account. I have been using Dropbox for almost 2 Years now as a free user. The 2 GB of free stage were sufficient for my documents and some pictures i syncronized with that account.
Reclaim your Data
My goal was to use my own Server to host a Sync-Platform similar to Dropbox but without the storage-limit and without the possibility of Dropbox giving away my Data to someone. I used incrontab and unison to achieve that goal.
Prerequisits
The following packets have to be installed on the clients:
unison (for the actual synchronization) incron (works as a trigger) The server needs to have
unison
running.
Replacing Dropbox
Stop the Dropbox daemon
dropboxd stop
make a new sync-directory, copy the files that need to be synced to this dir
Set up a bash-script that takes care of the syncing process:
mkdir ~/syncdir
cp -r ~/Dropbox/* ~/syncdir
LOCKFILE=/tmp/sync.lock
LOCAL=/home/koptein/syncdir
REMOTE=ssh://user@remote.server.org/syncdir/
if [ -e "$LOCKFILE" ]
then
echo "Exiting... Sync already running"
else
touch $LOCKFILE
sleep 3
# waiting for file IO to happen
unison -confirmbigdel=false -batch $LOCAL $REMOTE
rm -rf $LOCKFILE
fi
You probably want to trigger this script once for testing purposes and to overwatch the first sync-run. There may be questions to be answered to unison.
Almost done
Now all thats left to do is to tell incrontab to watch the syncdir for changes, plus to trigger the sync script once a change in the filesystem has been done.
fire up
incrontab -e
and put the following line into the editor:
/home/USER/syncdir IN_MODIFY,IN_CREATE,IN_DELETE,IN_CLOSE_WRITE,IN_MOVE /path/to/sync.sh
Now the synchromization is up and running. Dropbox has been replaced :)