Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm writing a shell script to back up my databases and send that backups to my Ubuntu One cloud. Basically, it dumps the databases into a sql file named after current date, putting it in a folder under /var/backups.

I need to make this folder /var/backups/whatever syncronizable to Ubuntu One, and make it sync every time a new file is posted there, all by commandline. How can I do these?

share|improve this question
add comment

3 Answers 3

up vote 0 down vote accepted

u1sdtool - command line utility for controlling ubuntuone-syncdaemon

First hit on Google when I search for "Ubuntu one from command line". Is it what you're looking for?

share|improve this answer
    
I already googled and discovered u1sdtool, but it's manpage doesn't helped me to know how to mark a folder to sync with it. Also, seems to me that tool works with folders already created and marked to sync. So, how can I mark a folder to sync with u1sdtool? –  João Santana Jun 24 '12 at 15:45
    
It looks pretty straightforward to me, although I've never used it so I won't swear by that. Can't you just run it with --list-folders to see what folders are synced now, add more with --create-folder and so on? –  bigbadonk420 Jun 24 '12 at 15:58
2  
Note that Ubuntu One will not sync folders outside your home folder, so you can't mark /var/backups as a synced folder. If that folder was under /home/yourusername then you could mark it as synced with u1sdtool --create-folder=/home/yourusername/backups and then anything put in it would automatically be synced without you needing to do anything else. –  sil Jun 24 '12 at 17:03
add comment

Can you make a symbolic link to your "not in home" folder to a folder in your home.

from terminal

$ cd /home/USERNAME/ubuntuone
$ mkdir FOLDERTOSYNC
$ sudo ln -s /var/backups/ /home/USERNAME/FOLDERTOSYNCC

If I understand symbolic links basically you should see every file in var/backup in your newly created folder in ubuntuone shared directories and also ubuntuone should see those files aand sync them, yes? I'm not exactly sure how ubuntu one works and have jjust now begun usiing symlinks myself (used too typing alot lol )but am now configuring it to backup my /mail/root so I can use ubuntu one as a administration mail client. I also have zoneminder which I eventually wish to backup any recorded motion detect events to ubuntu one/dropbox/drive/me/live

share|improve this answer
    
OR you can use Rsync or something similar to SYNC your "not-home" folder to the ubuntu one shared directory and let ubuntuone take it from there. Syncing two internal folders rather than symlink or bind will result in two copies of the directory but should still work in theory. Also it'll will take more time to sync internally and then sync externally as opposed to just creating a symlink or binding/mounting. –  Justin Gross Gross Jan 26 '13 at 21:25
    
actiually from what im reading it seems when setting up symlink ubuntu one gives problems. Also ubuntu one (running under user credentials?) needs to have write access to the folder your syncing which if you have a folder owned by root and are trying to sync with ONE it shouldn't work in theory. YOU COULD however set up a cron-job or create a daemon that runs the command "cp" and just copys the source files to the desitnation at ONE shared. again two copies of everything but when in ONE folder should take user ownership. Use "cp" Dont use "cp -a". Look up crontab file editing. –  Justin Gross Gross Jan 26 '13 at 21:32
add comment

After reading and reading which I LOOOVE to do this link when followed correctly will allow you to sync internally whatever folder to your home ubuntu one shared folder and from there it will sync.

rsync -a /source /destination 

If you want to maintain ownership/permissions/privileges/attributes (-a) OR

rsync /source /dest  

You might need to do it as root if your source is owned by root.

source of info: http://serverfault.com/questions/259938/cron-job-to-copy-file-from-one-location-to-another-for-new-files-daily

share|improve this answer
    
I don't think this provides an answer to the question. –  Eric Carvalho Jan 26 '13 at 22:03
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.