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.

Posted February 11, 2018 2k views
ApacheBillingUbuntu 16.04

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.

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.

×
2 answers

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.

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[‘REMOTEADDR’] == 'your ip number’)
requireonce('nextphp_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”;

Submit an Answer