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!
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!
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.
Hi there,
One option would be to use the
screen
command:https://www.digitalocean.com/community/tutorials/how-to-install-and-use-screen-on-an-ubuntu-cloud-server
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!
Best,
Bobby