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.
- sudo apt update
- sudo apt install nodejs npm
- npm install pm2@latest -g
- pm2 start gunthy-linux --name gunbot
- pm2 start /path/to/gunbot/gunthy-linux --name Gunbot
- pm2 logs gunbot
- pm2 save
- pm2 startup
- pm2 list
- pm2 monit
- pm2 stop gunbot
- pm2 restart gunbot
- pm2 delete gunbot
Install PM2 Process Manager.
Open terminal and execute each command one after the other.
Start your Gunbot instance using PM2.
Navigate to Your Gunbot Directory and run the command below.
You can also select a path to gunbot if your in a different directory.
Most commonly used PM2 Commands
Viewing the output of the Gunbot Console in PM2.
Save the PM2 Process List (Required for Auto-start)
Configure PM2 to Auto-start at System Reboot.
Check the list of applications managed by PM2.
Monitor logs, custom metrics, and other data.
Stop Gunbot.
Restart Gunbot.
Delete Gunbot from PM2 process list.