mirror of
https://github.com/EvolutionAPI/evolution-manager.git
synced 2025-12-19 11:32:18 -06:00
feat: cli v0.2.0
This commit is contained in:
18
lib/utils/detectPm2ProcessId.js
Normal file
18
lib/utils/detectPm2ProcessId.js
Normal file
@@ -0,0 +1,18 @@
|
||||
const { exec } = require('child_process');
|
||||
|
||||
module.exports = async () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
exec('pm2 jlist', async (err, stdout) => {
|
||||
if (err) {
|
||||
console.log('⚙️ PM2 is not installed');
|
||||
return reject(false);
|
||||
}
|
||||
|
||||
const list = JSON.parse(stdout);
|
||||
|
||||
const process = list.find((process) => process.name === 'evolution-manager');
|
||||
resolve(process ? process.pm_id : false);
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user