PM2
PM2 is an advanced process manager for node.js applications.
It'll help you to manage and keep the bot online 24/7
Installation
You can install globally using npm
:
npm install -g pm2
Usage
Then, you can just start your bot using this command:
pm2 start pm2.config.json
tip
To customize the name of the process, just edit the name
property in the pm2.config.json
config file.
Useful commands:
pm2 ls
-> list all the currently running process along with theirid
, run this command the first time and copy the id corresponding to your bot for furthermore commandspm2 stop <id>
-> stop the processpm2 restart <id>
-> restart the processpm2 log <id>
-> attach the log of the process to the current terminal window (you canctrl
+c
at anytime, it won't stop your bot)