0

I hosted my bot in GCP so it will be 24/7 online and when I start the bot by using the SSH browser it starts normally but when I close the SSH tab my bot goes automatically offline. what's the solution behind this? My bot has no errors at all + I tried hosting it in repl.it and it works fine.

Dharmaraj
  • 47,845
  • 8
  • 52
  • 84
Dissolved
  • 3
  • 1

1 Answers1

1

You should use a process manager like PM2. You can install it using NPM:

npm i -g pm2

That may require you to use sudo. After installation head to your Discord bot's directory and run these commands:

pm2 start index.js 

pm2 startup

pm2 save

Checkout PM2's documentation for detailed information.

Dharmaraj
  • 47,845
  • 8
  • 52
  • 84