From ac91cf2e832f41dd0aa7e990a157f6c48bd989b3 Mon Sep 17 00:00:00 2001 From: manipalutsav-svc Date: Wed, 28 Feb 2024 03:31:08 +0530 Subject: [PATCH] Update restart.js --- scripts/restart.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/restart.js b/scripts/restart.js index 8da059e..409f212 100644 --- a/scripts/restart.js +++ b/scripts/restart.js @@ -29,7 +29,12 @@ pm2.connect(async (err) => { console.log("Stopping it.") console.log(child_process.execSync("pm2 stop " + pm2_id).toString()); console.log("Terminating process " + pid); + try{ console.log(child_process.execSync("sudo kill " + pid).toString()); + } + catch(e){ + console.log("Failed to terminate process, reason:",e); + } } console.log("Restarting pm2 instance " + pm2_id); console.log(child_process.execSync("pm2 start " + pm2_id).toString()); @@ -41,4 +46,4 @@ pm2.connect(async (err) => { console.error("ERROR", e); process.exit(-1); } -}) \ No newline at end of file +})