Using CLI When Droplet Powered Off

  • Posted April 21, 2014

I’m trying to run part of the shell script found at…

…to be able to take a snapshot. However, the snapshot function within the script returns an error message.

{“status”:“ERROR”,“error_message”:“Droplet is currently on. Please power it off to run this event.”,“message”:“Droplet is currently on. Please power it off to run this event.”}

So I power off. But since the system is now down, I can’t run the shell program via the terminal. In searching for solutions with other articles and finding this one…

…,it too recommends powering off the droplet first, then to use curl and commands through the CLI .

However, the terminal window, usually available through Digital Ocean, is not viewable when the droplet is off. Nor can I connect through my PC’s terminal with ssh. How does one use CLI/terminal with a droplet powered off?

I’m probably overlooking something simple but can’t realize it. Many thanks to an answer.


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Running locally did it. Everything works. <br> <br>I appreciate your help.

From your PC’s Linux terminal, you do not need to connect to the powered off droplet to take the snapshot. You need to make a call to DigitalOcean’s API. For example, on your local PC, run this from the command line (using your real client ID and API key): <br> <br><pre> <br>curl -X GET “$DO_CLIENT_ID&api_key=$DO_API_KEY” <br></pre> <br> <br>It should return a JSON string that lists your droplets and information about them. You can do the same to take a snapshot. <br> <br><pre> <br>curl -s “$DROPLET_ID/snapshot/?client_id=$DO_CLIENT_ID&api_key=$DO_API_KEY” <br></pre> <br> <br>So if you want to use the script from the tutorial, just download it and use it locally.

Thanks again for the reply. <br> <br>Just to clarify and to state my current understanding of this problem… <br> <br>I need to spin a 2nd droplet and operate off of this active server, in order to be able to run a script to make a snapshot for the 1st droplet, which has to be powered off, in order to make the snapshot. <br> <br>That possessing just one droplet in power off mode won’t work, since 1) D.O.'s terminal for a shutdown droplet is not able to be accessed, and therefore can’t run the script, and 2) my PC’s Linux terminal won’t connect to a shutdown droplet, again, not allowing me to run the script. <br> <br>Overall, two droplets are needed. Is this right or am I still overlooking something? Thanks.

In both cases, the commands are meant to be run on the command line of a different machine than the droplet you want to snapshot. If you are using Mac or Linux, you can just use the terminal that came with the OS. If you are on windows you could run it from another droplet, or look into something like Cygwin: <br> <br> <br> <br>