From 64a1eab980415efb785f529420918f6b7368e018 Mon Sep 17 00:00:00 2001 From: frissdiegurke Date: Mon, 28 Apr 2014 11:39:50 +0200 Subject: [PATCH] use nodejs instead of node command if it exists closes #1449 --- nodebb | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/nodebb b/nodebb index f6c3a3d2a0..8c98a30fcf 100755 --- a/nodebb +++ b/nodebb @@ -4,6 +4,11 @@ # $1 action # $2 subaction +node="$(which nodejs 2>/dev/null)"; +if [ $? -gt 0 ]; + then node="$(which node)"; +fi + function pidExists() { if [ -e "pidfile" ]; then @@ -29,7 +34,7 @@ case "$1" in fi; # Start the loader daemon - node loader -d "$@" + "$node" loader -d "$@" ;; stop) @@ -77,24 +82,24 @@ case "$1" in npm install ls -d node_modules/nodebb* | xargs -n1 basename | xargs npm install ls -d node_modules/nodebb* | xargs -n1 basename | xargs npm update - node app --upgrade + "$node" app --upgrade touch package.json echo -e "\n\e[00;32mNodeBB Dependencies up-to-date!\e[00;00m"; ;; setup) - node app --setup "$@" + "$node" app --setup "$@" ;; reset) - node app --reset --$2 + "$node" app --reset --$2 ;; dev) echo "Launching NodeBB in \"development\" mode." echo "To run the production build of NodeBB, please use \"forever\"." echo "More Information: https://github.com/designcreateplay/NodeBB/wiki/How-to-run-NodeBB" - NODE_ENV=development node loader --no-daemon "$@" + NODE_ENV=development "$node" loader --no-daemon "$@" ;; watch)