Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
pm2.disconnect(function() {
console.log("disconnected....");
// kill the master controller and all slave miners
pm2.killDaemon(function() {
console.log("daemon killed....");
process.exit(0);
});
// return control to the caller
console.log("server shutdown...");
});
} else {
pm2.disconnect(function() {
// kill the master controller and all slave miners
pm2.killDaemon(function() {
// forget our previous slaves:
//allMiners = [];
// return control to the caller
callback();
});
});
},
setTimeout(function() {
pm2.killDaemon(function() {
// noop
});
}, 1000);
}
console.log(`Name: ${app.name}`);
console.log(`PID: ${app.pid}`);
console.log(`Status: ${app.pm2_env.status}`);
console.log(`Uptime: ${uptime}`);
console.log(`Autorestart: ${app.pm2_env.autorestart}`);
console.log(`Restart times: ${app.pm2_env.restart_time}`);
console.log(`Instances: ${app.pm2_env.instances}`);
console.log(`CPU usage: ${app.monit.cpu}`);
console.log(`MEM usage: ${app.monit.memory}`);
});
pm2.disconnect();
});
}
if (daemonOption === 'kill') {
pm2.killDaemon(error => {
console.log(`Ethstats daemon KILL ${(error) ? chalk.red(`[FAILED] ${error.message}`) : chalk.green('[OK]')}`);
pm2.disconnect();
process.exit((error) ? 1 : 0);
});
}
});
return new Promise((resolve, reject) => {
pm2.killDaemon(err => {
if (err) {
reject(err)
} else {
resolve(true)
}
})
})
}
pm2.connect(true,(err)=>{
if(err) return reject(err);
pm2.killDaemon((err,details)=>{
if(err){
return reject(err);
}
return resolve(details);
});
});
});
pm2Connect().then(() => {
try{
pm2.killDaemon((err: Error): void => {
pm2.disconnect()
if(err) {
logger.error(err)
reject(err)
return
}
resolve(true)
})
}catch(err){
pm2.disconnect()
logger.error(err)
reject(err)
}
}).catch(err => reject(err))
})