The easiest way to sync a local directory to Rackspace cloud files is through the console tools provided by the openstack/swift project. On ubuntu, the tools can be installed with apt-get install python-swiftclient
Then, assuming you are in the directory you want to upload, run the following command in the terminal:
$ swift -A https://auth.api.rackspacecloud.com/v1.0 -U <username> -K <api-key> upload <containername> . --changed
This will recursively upload the files from your current directory to the <containername>
container, saving time by uploading only changed files. You need to supply the <username>
you use to log in to the Cloud Control Panel and the <api-key>
available under Account / Account Settings in the same control panel.
Attention: If you use relative or absolute paths, swift will upload them with the pseudo-path provided on the command line into the container. So if instead of syncing .
you sync /var/www/test
, then files will end up under /var/www/test
pseudo-path of the container - most likely, this is not what you want.
Best Answer
I use two scripts to back up my VPS (hosted on Linode, but the same should work on Rackspace).
First, for mysql backup, I use the automysqlbackup script. It takes care of dumping your databases, compressing them, and maintaining several daily/weekly/monthly copies of the backup files. It can also email you the compressed .sql dumps as well.
For general filesystem backup, I use duplicity - this can use a number of different storage backends (ftp, scp, nfs, etc), but I choose to use the Amazon S3 backend. Duplicity will do either full or incremental backups depending on your need. It will also handle compression of your backup files as well as encryption if you so desire.