Skip to content

Instantly share code, notes, and snippets.

@kenperkins
Last active January 2, 2016 00:39
Show Gist options
  • Save kenperkins/8225306 to your computer and use it in GitHub Desktop.
Save kenperkins/8225306 to your computer and use it in GitHub Desktop.
Reboot a server from the command line
  1. Save reboot.js to your local machine
  2. In the directory you have reboot.js run:
  > npm install pkgcloud
  1. run the script:
  > node reboot.js <your-rackspace-username> <your-rackspace-api-key> <region> <server-id> <reboot-type>

For example:

  > node reboot.js my-account foo-bar-123456 ORD 1-2-3-4-5 hard
var pkgcloud = require('pkgcloud');
var client = pkgcloud.providers.rackspace.compute.createClient({
username: process.argv[2],
apiKey: process.argv[3],
region: process.argv[4]
});
client.rebootServer(process.argv[5], { type: process.argv[6] }, function (err) {
console.dir(err);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment