Manging Gunbot with PM2 Process Manager

shape
shape
shape
shape
shape
shape
shape
shape
image

Manging Gunbot with PM2 Process Manager

PM2 (Process Manager 2) is a popular process manager that helps you manage and keep your applications running smoothly. We require PM2 in order to run the Gunbot application in the background. If you run Gunbot directly in a normal terminal session and then disconnect from your VPS, the application will terminate along with the session. This is because the application is tied to the terminal session that you started it from.

    Install PM2 Process Manager.

    Open terminal and execute each command one after the other.

  • sudo apt update
  • sudo apt install nodejs npm
  • npm install pm2@latest -g

  • Start your Gunbot instance using PM2.

    Navigate to Your Gunbot Directory and run the command below.

  • pm2 start gunthy-linux --name gunbot
  • You can also select a path to gunbot if your in a different directory.

  • pm2 start /path/to/gunbot/gunthy-linux --name Gunbot

  • Most commonly used PM2 Commands


    Viewing the output of the Gunbot Console in PM2.

  • pm2 logs gunbot

  • Save the PM2 Process List (Required for Auto-start)

  • pm2 save

  • Configure PM2 to Auto-start at System Reboot.

  • pm2 startup

  • Check the list of applications managed by PM2.

  • pm2 list

  • Monitor logs, custom metrics, and other data.

  • pm2 monit

  • Stop Gunbot.

  • pm2 stop gunbot

  • Restart Gunbot.

  • pm2 restart gunbot

  • Delete Gunbot from PM2 process list.

  • pm2 delete gunbot