From 783481e644e16d48557ad74e4cf58f05a0f13635 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Tue, 4 Nov 2014 17:39:13 -0500 Subject: [PATCH] Support for reloading nodebb via the nodebb executable --- loader.js | 1 + nodebb | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/loader.js b/loader.js index 81be2fb572..998bd9bd5e 100644 --- a/loader.js +++ b/loader.js @@ -41,6 +41,7 @@ Loader.init = function(callback) { } process.on('SIGHUP', Loader.restart); + process.on('SIGUSR2', Loader.reload); callback(); }; diff --git a/nodebb b/nodebb index 0db6fe2f38..a75c075b2f 100755 --- a/nodebb +++ b/nodebb @@ -43,7 +43,7 @@ case "$1" in fi ;; - reload|restart) + restart) pidExists; if [ 0 -eq $? ]; then @@ -54,6 +54,17 @@ case "$1" in fi ;; + reload) + pidExists; + if [ 0 -eq $? ]; + then + echo "NodeBB could not be reloaded, as a running instance could not be found."; + else + echo "Reloading NodeBB."; + kill -12 $(cat pidfile); + fi + ;; + status) pidExists; if [ 0 -eq $? ];