Question

How to make web service unavailable. As I develop this application, I'd rather not be burning up CPU or access time when not logged in.

Not getting any errors but I notice long periods of CPU usage when I am not actually online developing. The service should not be running while I am not logged in for development. How do I turn off the service so that CPU time is not used?

Running Apache2/WSGI with Python3.


Submit an answer

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!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Assuming:

  1. your webservice starts with a php-file.

  2. You work from a fixed ip-number.

Add these lines to the php start file.

if ($_SERVER[‘REMOTE_ADDR’] == ‘your ip number’) require_once(‘next_php_file.php’); else echo ‘<html><head><title>Your web service</title></head><body>’ . “\n” . ‘<h4>This is the most interesting page of the whole internet.</h4>’ . “\n” . ‘<p>And you are not allowed to see it !!!</p>’ . “\n” . ‘</body></html>’ . “\n”;

Reducing monthly charges for a droplet that you don’t need all the time using Snapshots:

Keep in mind as long as your Droplet exists, you will be billed hourly for it. BUT you can take a snapshot of your Droplet and destroy it, then re-create it again from the snapshot later when you need it.

More context from Billing and Pricing FAQ:

You can turn the Droplet off in the control panel or from the command line, but since your disk space, CPU, RAM, and IP address are all reserved while your Droplet is powered off, you’ll still be charged for a Droplet when it’s powered off.

If you want to save a Droplet for future use take a snapshot of it and then destroy it. You’ll be able to create a new Droplet from the snapshot image anytime to bring it back online.

But snapshots also cost (less) money because they take up disk space. Snapshots are billed at $.05/GB/mo, so a 40GB snapshot costs $2/month.