I have been using this wonderful script written by Chmouel Boudjnah to backup important files to Rackspace Cloud Files container. You can read more about the original script in his article Upload to Rackspace Cloud Files in a shell script.
In September 2012 Rackspace introduced the ability for customers to select a data center to store and retrieve their content, see Cloud Files Adds Multi Region Support. Currently there are two data centers available for US customers – Chicago (ORD) and Dallas (DFW). This is a great opportunity if you are looking to achieve a higher level of redundancy by storing your backups in more than one data center.
In order to use this feature Rackspace Cloud Identity API v1.1 or newer has to be used. Unfortunately Chmouel’s script lacks multi-region support because it uses API v1.0.
So based on Cloud Files cURL Cookbook I wrote a script that uses newer API and offers multi-region support. The project is available on GitHub.
Below are a few examples.
Creating a new container
rackspace-cloudfiles.sh -u USERNAME -k API_KEY -r ORD -x PUT -c NEW_CONTAINER
Uploading file into a container
rackspace-cloudfiles.sh -u USERNAME -k API_KEY -r ORD -x PUT -c CONTAINER /path/to/file
Currently only uploading is implemented. Other operations such as downloading an object, deleting an object or getting a list of containers or objects in a container will be implemented later.
Is this script still current? Because I Rackspace now has API v2.0 from reading through their information.
When I run this script, I got this error (yes I am using SYD data center).
Yes, the script works fine on my systems. It’s using API v1.1 which is still supported. Seems like your version of
readlink
doesn’t support-f
option. See if this article or this article can help. Seems that you need to installgreadlink
and replace all occurrences ofreadlink
withgreadlink
.Thanks, I am using Mac OS X (I am guessing you knew that from the error), so I followed the above instructions to install Brew and use greadlink.
Further, someone might find this helpful as I spent quite some time trying to work out how to script the entire process (I am quite clueless when it comes to scripting). All the other parameters I recorded in the script itself.