From 20b5d577dd703a1ede7c06d7f0ba1dfcb565fa11 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Thu, 27 Feb 2014 20:36:04 -0500 Subject: [PATCH 1/2] ability to restart nodebb via executable --- loader.js | 12 ++++++++---- nodebb | 11 ++++++++++- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/loader.js b/loader.js index 3bb103d417..2effb4ffa0 100644 --- a/loader.js +++ b/loader.js @@ -14,10 +14,7 @@ var nconf = require('nconf'), nbb.on('message', function(cmd) { if (cmd === 'nodebb:restart') { - nbb.on('exit', function() { - nbb_start(); - }); - nbb.kill(); + nbb_restart(); } }); }, @@ -29,10 +26,17 @@ var nconf = require('nconf'), fs.unlinkSync(pidFilePath); } } + }, + nbb_restart = function() { + nbb.on('exit', function() { + nbb_start(); + }); + nbb.kill(); }; process.on('SIGINT', nbb_stop); process.on('SIGTERM', nbb_stop); + process.on('SIGHUP', nbb_restart); nbb_start(); }, diff --git a/nodebb b/nodebb index 107d96259e..bc52d69657 100755 --- a/nodebb +++ b/nodebb @@ -9,6 +9,7 @@ case "$1" in echo "Starting NodeBB"; echo " \"./nodebb stop\" to stop the NodeBB server"; echo " \"./nodebb log\" to view server output"; + echo "" > ./logs/output.log; node loader -d "$@" ;; @@ -17,7 +18,13 @@ case "$1" in kill `cat pidfile`; ;; + reload|restart) + echo "Restarting NodeBB."; + kill -1 `cat pidfile`; + ;; + log) + clear; tail -F ./logs/output.log; ;; @@ -54,11 +61,13 @@ case "$1" in *) echo "Welcome to NodeBB" - echo $"Usage: $0 {start|stop|log|setup|reset|upgrade|dev|watch}" + echo $"Usage: $0 {start|stop|reoad|restart|log|setup|reset|upgrade|dev|watch}" echo '' column -s ' ' -t <<< ' start Start the NodeBB server stop Stops the NodeBB server + reload Restarts NodeBB + restart Restarts NodeBB log Opens the logging interface (useful for debugging) setup Runs the NodeBB setup script reset Disables all plugins, restores the default theme. From ed0a17b94a77c39767b39f766b4189a9371bdc70 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Thu, 27 Feb 2014 23:24:52 -0500 Subject: [PATCH 2/2] reoad, lol --- nodebb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nodebb b/nodebb index bc52d69657..d33baeba04 100755 --- a/nodebb +++ b/nodebb @@ -61,7 +61,7 @@ case "$1" in *) echo "Welcome to NodeBB" - echo $"Usage: $0 {start|stop|reoad|restart|log|setup|reset|upgrade|dev|watch}" + echo $"Usage: $0 {start|stop|reload|restart|log|setup|reset|upgrade|dev|watch}" echo '' column -s ' ' -t <<< ' start Start the NodeBB server