From 4c36ee6922b58098e0521d70736507d2b7cd6c30 Mon Sep 17 00:00:00 2001 From: Moul <moul@moul.re> Date: Thu, 30 Mar 2017 17:07:28 +0200 Subject: [PATCH] [enh] show daemon status on cli. --- app/modules/daemon.js | 5 +++++ bin/daemon | 8 ++++++++ duniter.sh | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/app/modules/daemon.js b/app/modules/daemon.js index b228bbe34..f572511dd 100644 --- a/app/modules/daemon.js +++ b/app/modules/daemon.js @@ -29,6 +29,11 @@ module.exports = { return new Promise(() => null); // Never ending }) + },{ + name: 'status', + desc: 'Show Duniter node daemon status.', + logs: false, + onConfiguredExecute: (server) => needsToBeLaunchedByScript(server.logger) },{ name: 'stop', desc: 'Stop Duniter node daemon.', diff --git a/bin/daemon b/bin/daemon index b206f425e..723c50b7b 100755 --- a/bin/daemon +++ b/bin/daemon @@ -17,6 +17,14 @@ switch (process.argv[2]) { daemon.stop(); break; + case "status": + if (daemon.status()) { + console.log('Duniter daemon status: running'); + } else { + console.log('Duniter daemon status: stopped'); + } + break; + case "sync": case "reset": const command = process.argv[2]; diff --git a/duniter.sh b/duniter.sh index 00edd7b18..c3f7f993e 100755 --- a/duniter.sh +++ b/duniter.sh @@ -45,7 +45,7 @@ duniter() { # DUNITER DAEMON MANAGEMENT #--------------------------------- - reset|start|stop|restart|webstart|webrestart) + reset|start|stop|status|restart|webstart|webrestart) $NODE "$DUNITER_DIR/bin/daemon" $* ;; -- GitLab