Destroy job after it's been executed when using digitalocean app

Is it possible to destroy a job after it has been executed. For example when using the job to run migrations for the service. This job will be executed before the deployment so after the deployment this job will do nothing. Can I configure something that this job will be destroyed after it’s been executed to reduce the costs of hosting?

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.

Bobby Iliev
Site Moderator
Site Moderator badge
April 10, 2023

Hi there,

When you create a job to run migrations or any other task, the job will run to completion and then automatically stop.

I believe that you won’t be billed for the time the job is not running, as the billing is based on the actual usage of resources during the job execution.

You don’t need to manually destroy the job after it has been executed, as the platform will take care of stopping the job once it’s completed.

If you prefer not to have the job at all, what I personally have been doing is adding my migrations command right before my run command separated with a ;, here is an example of how to do that with Laravel but it should be similar for other frameworks as well:

Hope that this helps!



Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

card icon
Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Sign up
card icon
Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We’d like to help.

Learn more
card icon
Become a contributor

You get paid; we donate to tech nonprofits.

Learn more
Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow – whether you’re running one virtual machine or ten thousand.

Learn more ->
DigitalOcean Cloud Control Panel