![]() |
cloudsync.sh, replacement to DropBox and whatever you have
Well, lately there were some threads about problems with Dropbox clients etc, and this makes me wonder...
I myself question the need to have an application and some external service just to sync my stuff. It seems a overkill, why do you need to do things the hard way when same (or better) functionality can be achieved with a simple shell script? I have been syncing my data up&down with this kind of setup. This is easy to implement, portable, robust and beautiful. 1. You need to install few niceties first. This script uses rsync with a crontab trigger, so get those from rzr's Harmattan repository. (I don't know about Frematle repositories but I belive cron and rsync are there too...)
2. You need to create a pair of rsa keys and install the public key to the cloudservers users authorized_keys, just the standard stuff. I recommend creating a dummy user just for the sync purposes... 3. Here is the cloudsync.sh script, put it to your "/root" for example: Code:
#!/bin/sh Code:
G_USERNAME="your_cloudserver_username_goes_here" Code:
~ # DESCRIPTION: So, for the people who bothered to read to the end of this posting :D This script can be modified to sync any desired directories. This example syncs my:
The folder "upload" on the cloudserver is synced to "Downloads" on the users MyDocs, and same applies, anything goes. The script detects if you are on home network and uses direct connection to the cloudserver if so. Of course that works this way for me because I have my servers on the same subnet as my WLAN. You might want to modify that setup based on your network configuration... The crontab entry launches cloudsync every 30 minutes, and additionaly it can be launched at any given moment directly. The script creates a lockfile in /var/lock to prevent double invocation. Security related thingies;
|
Re: Arch Linux ARM on N900
Good job......juicy buddy
|
Re: cloudsync.sh, replacement to DropBox and whatever you have
This is cool. The one thing I like about dropbox, though is that it is 'event-based'. E.g, put a file there, and the kernel knows and does the sync then and there.
Perhaps you could use a python wrapper or something that uses inotify and then the same effect could be achieved without cron. Just an idea. |
Re: cloudsync.sh, replacement to DropBox and whatever you have
I had a such project to do this over webdav ...
|
Re: cloudsync.sh, replacement to DropBox and whatever you have
Quote:
On the other hand, if there's something on the cloud end that needs to be synced immeiately to the phone it's a trickier situation. If that's needed then the phone would have to poll the remonte end at some shortish interval which is a sure battery killer. |
Re: cloudsync.sh, replacement to DropBox and whatever you have
Quote:
I guess normally dropbox reacts when you copy a file to the wtched directory, but what if a file is modified in the directory, should it be uploaded immediately? |
Re: cloudsync.sh, replacement to DropBox and whatever you have
Last time I tried to implement my own sync solution with rsync I stumbled upon the inability of rsync to track deleted files in two way syncs. If you pass -delete it deletes missing files for both ends regardless if a file is new on one side. I resorted to using unison, which works like a charm four-way between my windows pc, ubuntu box, N900 and macbook. I suppose that compiling it for N9 should be trivial, if the debian binary doesn't work oob.
|
Re: cloudsync.sh, replacement to DropBox and whatever you have
Yes, it might get tricky if you want to handle more than just updates. That's the reason I just upsync stuff most of the time, and I have separate directory for things to download to the device from cloud.
Here is a quick&dirty solution for monitoring a directory (/home/user/mydocs/Upload/) and immediately syncing the content to cloud if a new file is dropped there: Code:
#!/usr/bin/python Code:
G_LOGTAG="cloudsync" |
Re: cloudsync.sh, replacement to DropBox and whatever you have
While on topic, would anybody here want to try to evaluate sparkleshare for fremantle and harmattan?
|
Just a question:
When you update an existing file, do you upload/download a whole file or just the part of the file that changed? |
All times are GMT. The time now is 10:29. |
vBulletin® Version 3.8.8