This bot let you control PM2 with Telegram
Added env variable at config.json of bot owner telegram id, which prevents unauthorized users from command access
"name": "PM2 Bot",
"script": "bot.js",
"watch": true,
"env": {
"TOKEN": "your token from botfather here",
"ID": 111111111 <- this is your telegram user id - integer
}
}
- Clone the repository in the same computer/server where pm2 is running
- Run
npm install
in the same directory as the project files to install all the dependencies - you have two options to run the bot:
- Open
bot.js
and add the telegram token that @botFather gave you and then runnode bot.js
:
const TOKEN = process.env.TOKEN || "YOUR TOKEN HERE";
- Open
config.json
and add the telegram token that @botFather gave you and then runpm2 start config.json
:
"TOKEN": "",
For now there are only two commands available, list and restart.
List all the processes that pm2 is managing
Let you restart or start a process by the name or the id, you can also use all
to restart all the proccesses.