How to Keep Process Running After Closing Console

I am new to VPS hosting and successfully migrated my .NET-based Discord bot from a different hosting provider to a Droplet so I could have more control over the bot’s hosting machine. I am able to launch the bot using the command line, but I have found that I need to keep the console open while the bot is running; if I close the console window (or turn off my computer, etc.), the bot stops running. I imagine closing the window automatically logs out the user, which in turn stops the process.

It is a little inconvenient for me to keep a separate window open and either keep my computer running 24/7 or face mandatory downtime whenever it is turned off. Is there a way to keep the process running even after I close the console window? Thanks!

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
March 2, 2023
Accepted Answer

Hi there,

One option would be to use the screen command:

That way you will be able to start your process in a screen session and then detach for it and close your terminal.

An alternative option, is to create a Docker image and then start a Docker container with your app.

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

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

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

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

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