Alteração para salvar a lista do pm2

pull/21/head
adriano 2023-04-10 11:29:16 -03:00
parent 54ab3cb297
commit 0688bf34d4
1 changed files with 15 additions and 1 deletions

View File

@ -1,4 +1,5 @@
const pm2 = require('pm2'); const pm2 = require('pm2');
const { execSync } = require("child_process");
function startPm2Process(process_name, file, path, port) { function startPm2Process(process_name, file, path, port) {
@ -21,6 +22,19 @@ function startPm2Process(process_name, file, path, port) {
console.error(err); console.error(err);
// process.exit(2); // process.exit(2);
} }
else {
execSync(`pm2 save --force`, { cwd: path }, (error, stdout, stderr) => {
if (error) {
console.log(`error: ${error.message}`);
return;
}
if (stderr) {
console.log(`stderr: ${stderr}`);
return;
}
console.log(`stdout: ${stdout}`);
});
}
pm2.disconnect(); pm2.disconnect();
}); });