Question about self hosting a discord bot

Hello,

If I am self hosting a bot, how can I keep it online without having to keep the terminal open? At the moment, if I close the cmd.exe window that is SSHing to my Pi, the Discord bot shuts down.

image

@RiversideRocks I use pm2 when hosting bots on my Pi and I can close the terminal window. It also allows you to manage your applications even with a free web dashboard that is hosted online for you (e.g. Restart it when it shuts down, look at stats like CPU and Memory, etc.) and allows you to run multiple node apps at the same time.
Hope this helps :slight_smile:

6 Likes

Ah, that looks really cool! I’ll check it out!

1 Like

You could also use tmux or screen :wink:

I usually just use docker and docker-compose because it makes management really easy when my applications also needs other software.

2 Likes

Sounds confusing :confused: :joy: I picked up pm2 in a short while, there are many different tutorials available for it, which is also probably the case for the options you proposed :slight_smile:

1 Like

There’s a module called forever. It will run a script file forever and continuously.

Install:

npm i -g forever

Usage:

forever start server.js

and it will run server.js forever until you tell it to stop even if you close the terminal which you can do using

forever stop server.js
6 Likes