By aaronmweiss
I’m building a script that automatically will shutdown a droplet before it creates a snapshot, and then powers it back on.
The snapshot takes time to complete, but I think it would be great to see progress indicator. Any ideas on how to do this?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Accepted Answer
When scripting with doctl you can pass the --wait flag to Droplet “action” commands in order to block until the action has completed. For example:
doctl compute droplet-action power-off --wait <droplet-id>
Unfortunately, as the API does not report back detailed progress information, creating an accurate progress indicator would not be possible. You can vote for this feature request on ideas.digitalocean.com to show your support for that feature.
There are a number of different approaches you could take to add a spinner to indicate that the script is still working. This blog post is a good explanation of how these tend to work.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.