Report this

What is the reason for this report?

Progress Indicator for DOCTL Commands

Posted on December 9, 2019

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!

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.

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.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.