I want the droplet to run at certain times during the day, how can I do this. I dont want to do any coding as it was difficult enought to set it up :)

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

Hey, @caolanwiggins753

Could you please confirm if you would like to make the droplet running at certain times during the day for x period of time and then shutdown the droplet until you needs to run some tasks/jobs again? May I ask why this is needed?

Keep in mind that even if your droplet is powered off it’s still taking up space on the server and thus you’re still been charged for it.

Regards,
Alex

We are making abot to run a browser based game, to prevent us triping the anti cheat system we need it to not run 24/7.

hence why we would like it run at certain times.

  • Hello, @caolanwiggins753

    Thanks for explaining this. What I can recommend you is to use the DigitalOcean API to simply power off and power on the droplet when this is needed. The exact commands to use are:

    curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer b7d03a6947b217efb6f3ec3bd3504582" -d '{"type":"power_off"}' "https://api.digitalocean.com/v2/droplets/3164450/actions" 
    

    Where you need to change b7d03a6947b217efb6f3ec3bd3504582 with your actual API token which you can generate from your account.

    In order to power on the droplet you can then execute:

    curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer b7d03a6947b217efb6f3ec3bd3504582" -d '{"type":"power_on"}' "https://api.digitalocean.com/v2/droplets/3164450/actions"
    

    Where again you need to change b7d03a6947b217efb6f3ec3bd3504582 with your actual API token.

    You can find more information about the the DigitalOcean API here:

    https://developers.digitalocean.com/documentation/v2/#power-off-a-droplet

    https://developers.digitalocean.com/documentation/v2/#power-on-a-droplet

    The process is really simple and the commands can be executed directly in the command line. You can also make a cron jobs to execute the commands for you.

    Regards,
    Alex

Submit an Answer