Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
68 lines (60 sloc) 5.69 KB
rscurl.sh is an atempt to create a command line tool that interfaces with Rackspace Cloud Server's API. The goal in creating it was to use widely available tools so it is written as a shell script and uses apt, curl, grep, sed, and tr. It has been tested on Apple OS X terminal, CentOS, and Ubuntu.
It supports the following commands:
list-servers - Lists all the servers you have on your account.
list-flavors - Lists all the types of server that are available to you.
list-images - Lists all the server images that are available to you.
create-server - Creates a new server
delete-server - Deletes a server
rebuild - Rebuilds a server with the new image, all data will be lost.
resize - Resizes a server
confirm-resize - Confirms a recently resized server, after 24 hours it is done automatically.
revert-resize - Reverts a recently resized server to the previous size.
reboot - Reboots a server
force-reboot - Forces a server to reboot, equivalent to pulling the power.
create-image - Creates a new image based on an existing server.
delete-image - Deletes a server image that you own.
Here is an example of the output for the servers, flavors, and images.
Servers:
ID Server Image Server Flavor Status Server Name Public IP Private IP
------ --------------------------------------- ------------------- --------- ------------------------------------------------- ------------------- -------------------
318954 "Ubuntu-10.04-LTS-(lucid)" "256-server" "ACTIVE" "server1.mydomain.com" ["184.106.xxx.xxx"] ["10.179.xxx.xxx"]
320685 "Ubuntu-10.04-LTS-(lucid)" "256-server" "ACTIVE" "server2.mydomain.com" ["184.106.xxx.xxx"] ["10.179.xxx.xxx"]
345576 "Ubuntu-10.04-LTS-(lucid)" "2GB-server" "ACTIVE" "server3.mydomain.com" ["184.106.xxx.xxx"] ["10.179.xxx.xxx"]
345590 "Ubuntu-10.04-LTS-(lucid)" "2GB-server" "ACTIVE" "server4.mydomain.com" ["184.106.xxx.xxx"] ["10.179.xxx.xxx"]
345673 "Ubuntu-10.04-LTS-(lucid)" "2GB-server" "ACTIVE" "server5.mydomain.com" ["184.106.xxx.xxx"] ["10.179.xxx.xxx"]
347022 "Ubuntu-10.04-LTS-(lucid)" "2GB-server" "ACTIVE" "server6.mydomain.com" ["184.106.xxx.xxx"] ["10.179.xxx.xxx"]
Images:
ID Image Name Status Date Created Date Updated
--------- --------------------------------------- --------- ----------------------------- -----------------------------
71 "Fedora 14" "ACTIVE" "2010-10-13T19:00:00-05:00" "2010-11-10T08:35:36-06:00"
29 "Windows Server 2003 R2 SP2 x86" "ACTIVE" "2010-01-26T12:07:32-06:00" "2010-01-26T12:07:32-06:00"
69 "Ubuntu 10.10 (maverick)" "ACTIVE" "2010-10-13T19:00:00-05:00" "2010-10-21T15:36:29-05:00"
41 "Oracle EL JeOS Release 5 Update 3" "ACTIVE" "2010-03-23T05:31:38-05:00" "2010-09-20T09:08:35-05:00"
40 "Oracle EL Server Release 5 Update 4" "ACTIVE" "2010-03-23T05:31:31-05:00" "2010-10-28T11:40:20-05:00"
187811 "CentOS 5.4" "ACTIVE" "2009-12-16T01:02:17-06:00" "2009-12-16T01:02:17-06:00"
4 "Debian 5.0 (lenny)" "ACTIVE" "2009-07-15T17:09:29-05:00" "2009-08-26T14:59:52-05:00"
10 "Ubuntu 8.04.2 LTS (hardy)" "ACTIVE" "2009-07-15T16:54:54-05:00" "2009-08-26T14:59:54-05:00"
23 "Windows Server 2003 R2 SP2 x64" "ACTIVE" "2010-01-26T12:05:53-06:00" "2010-01-26T12:05:53-06:00"
24 "Windows Server 2008 SP2 x64" "ACTIVE" "2010-01-26T12:07:04-06:00" "2010-01-26T12:07:04-06:00"
49 "Ubuntu 10.04 LTS (lucid)" "ACTIVE" "2009-04-29T04:00:00-05:00" "2010-05-04T08:58:18-05:00"
14362 "Ubuntu 9.10 (karmic)" "ACTIVE" "2009-11-06T05:09:40-06:00" "2009-11-06T05:09:40-06:00"
62 "Red Hat Enterprise Linux 5.5" "ACTIVE" "2010-09-14T03:05:31-05:00" "2010-11-10T00:08:26-06:00"
53 "Fedora 13" "ACTIVE" "2009-05-25T12:00:00-05:00" "2010-06-27T20:13:08-05:00"
17 "Fedora 12" "ACTIVE" "2009-12-15T06:38:16-06:00" "2009-12-15T15:43:59-06:00"
31 "Windows Server 2008 SP2 x86" "ACTIVE" "2010-01-26T12:07:44-06:00" "2010-01-26T12:07:44-06:00"
51 "CentOS 5.5" "ACTIVE" "2009-05-14T12:00:00-05:00" "2010-05-21T00:01:43-05:00"
14 "Red Hat Enterprise Linux 5.4" "ACTIVE" "2009-12-15T06:41:26-06:00" "2009-12-15T15:37:22-06:00"
19 "Gentoo 10.1" "ACTIVE" "2009-12-15T06:36:24-06:00" "2009-12-15T15:43:39-06:00"
28 "Windows Server 2008 R2 x64" "ACTIVE" "2010-01-26T12:07:17-06:00" "2010-01-26T12:07:17-06:00"
55 "Arch 2010.05" "ACTIVE" "2009-05-25T12:00:00-05:00" "2010-06-29T05:21:55-05:00"
6491021 "Charlie" "ACTIVE" "2010-11-11T05:00:21-06:00" "2010-11-11T23:55:23-06:00"
Flavors:
ID RAM(M) Disk(G) Flavor Name
----- -------- -------- ----------
1 256 10 "256 server"
2 512 20 "512 server"
3 1024 40 "1GB server"
4 2048 80 "2GB server"
5 4096 160 "4GB server"
6 8192 320 "8GB server"
7 15872 620 "15.5GB server"