|
2013-04-23
, 17:38
|
Posts: 466 |
Thanked: 661 times |
Joined on Jan 2009
|
#3
|
|
2013-04-23
, 18:18
|
|
Posts: 1,348 |
Thanked: 1,863 times |
Joined on Jan 2009
@ fr/35/rennes
|
#4
|
The Following User Says Thank You to www.rzr.online.fr For This Useful Post: | ||
|
2013-04-23
, 18:34
|
Community Council |
Posts: 4,920 |
Thanked: 12,867 times |
Joined on May 2012
@ Southerrn Finland
|
#5
|
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.
The Following 2 Users Say Thank You to juiceme For This Useful Post: | ||
|
2013-04-23
, 20:09
|
Community Council |
Posts: 4,920 |
Thanked: 12,867 times |
Joined on May 2012
@ Southerrn Finland
|
#6
|
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.
The Following User Says Thank You to juiceme For This Useful Post: | ||
|
2013-04-23
, 21:33
|
|
Moderator |
Posts: 2,622 |
Thanked: 5,447 times |
Joined on Jan 2010
|
#7
|
The Following 3 Users Say Thank You to qwazix For This Useful Post: | ||
|
2013-04-23
, 21:44
|
Community Council |
Posts: 4,920 |
Thanked: 12,867 times |
Joined on May 2012
@ Southerrn Finland
|
#8
|
#!/usr/bin/python import os import subprocess import pyinotify watchmanager = pyinotify.WatchManager() watchmask = pyinotify.IN_CREATE class watchprocess(pyinotify.ProcessEvent): def process_IN_CREATE(self, event): subprocess.call("/root/upload2cloud.sh", shell=True) inotifier = pyinotify.Notifier(watchmanager, watchprocess()) ret = watchmanager.add_watch('/home/user/MyDocs/Upload', watchmask, rec=True) while True: try: inotifier.process_events() if inotifier.check_events(): inotifier.read_events() except KeyboardInterrupt: inotifier.stop() break
G_LOGTAG="cloudsync" G_LOCKFILE="/var/lock/update2cloud.pid" G_USERNAME="your_cloudserver_username_goes_here" G_DNSNAME="dns.name.of.your.cloudserver" G_LOCALNAME="server.local.ip.address" G_OWNIP="ip.given.to.me" G_UPLOAD_DIR="/home/user/MyDocs/Upload/" logger -t "$G_LOGTAG" "Triggered upload from filesystem" if [ -e "$G_LOCKFILE" ]; then logger -t "$G_LOGTAG" "Cannot get lock $G_LOCKFILE, exiting" exit 1 fi echo "$$" > "$G_LOCKFILE" ## get the wlan state to see if we're in home network aa=$(/sbin/ifconfig wlan0 | grep "$G_OWNIP") if [ "$?" -eq "0" ]; then G_CLOUDHOST=$G_LOCALNAME logger -t "$G_LOGTAG" "Using WLAN connection to server $G_CLOUDHOST" else G_CLOUDHOST=$G_DNSNAME logger -t "$G_LOGTAG" "Using GPRS connection to server $G_CLOUDHOST" fi G_SYNC=$(/usr/bin/rsync -av $G_UPLOAD_DIR $G_USERNAME@$G_CLOUDHOST:download) G_RET=$? logger -t "$G_LOGTAG" "$G_SYNC" if [ "$G_RET" -eq "0" ]; then logger -t "$G_LOGTAG" "Upload tranfer succeeded" else logger -t "$G_LOGTAG" "Upload transfer failed (error code $G_RET)" fi rm -f "$G_LOCKFILE" return 0
The Following 7 Users Say Thank You to juiceme For This Useful Post: | ||
|
2013-04-25
, 00:58
|
Posts: 466 |
Thanked: 661 times |
Joined on Jan 2009
|
#9
|
The Following User Says Thank You to jackburton For This Useful Post: | ||
|
2013-04-27
, 08:20
|
|
Posts: 665 |
Thanked: 2,388 times |
Joined on Feb 2012
@ Zagreb, Croatia
|
#10
|
The Following User Says Thank You to knobtviker For This Useful Post: | ||
Tags |
cloud sync, maemo 5 |
|
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:
DESCRIPTION:
So, for the people who bothered to read to the end of this posting
This script can be modified to sync any desired directories. This example syncs my:
- DCIM
- .backups
- AptBackup
- meeTrainer_workouts
- .CallRecorder
- Pictures
folders, but that's just my preferences. Anything goes.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;