You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nodebb/nodebb

113 lines
2.6 KiB
Plaintext

11 years ago
#!/bin/bash
# $0 script path
# $1 action
# $2 subaction
11 years ago
function pidExists() {
if [ -e "pidfile" ];
then
kill -s 0 $(cat pidfile);
if [ !$? ];
then return 1;
else return 0;
fi
else
return 0;
fi
}
11 years ago
case "$1" in
start)
echo "Starting NodeBB";
echo " \"./nodebb stop\" to stop the NodeBB server";
echo " \"./nodebb log\" to view server output";
if [ -f "./logs/output.log" ]; # Preserve the last output log
then
mv ./logs/output.log ./logs/output.1.log;
fi;
# Start the loader daemon
node loader -d "$@"
;;
stop)
echo "Stopping NodeBB. Goodbye!";
11 years ago
kill $(cat pidfile);
;;
reload|restart)
echo "Restarting NodeBB.";
11 years ago
kill -1 $(cat pidfile);
;;
status)
pidExists;
if [ 0 -eq $? ];
then
echo "NodeBB is not running";
echo " \"./nodebb start\" to launch the NodeBB server";
else
echo "NodeBB Running (pid $(cat pidfile))";
echo " \"./nodebb stop\" to stop the NodeBB server";
echo " \"./nodebb log\" to view server output";
echo " \"./nodebb restart\" to restart NodeBB";
fi
;;
log)
clear;
tail -F ./logs/output.log;
11 years ago
;;
upgrade)
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 loader --upgrade
11 years ago
touch package.json
echo -e "\n\e[00;32mNodeBB Dependencies up-to-date!\e[00;00m";
;;
11 years ago
setup)
node loader --setup "$@"
11 years ago
;;
reset)
node loader --reset --$2
;;
11 years ago
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 "$@"
11 years ago
;;
watch)
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 supervisor -q --ignore public/templates --extensions 'node|js|tpl' -- app "$@"
11 years ago
;;
*)
echo "Welcome to NodeBB"
11 years ago
echo $"Usage: $0 {start|stop|reload|restart|log|setup|reset|upgrade|dev|watch}"
11 years ago
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.
upgrade Run NodeBB upgrade scripts, ensure packages are up-to-date
dev Start NodeBB in interactive development mode
watch Start NodeBB in development mode and watch for changes
11 years ago
'
exit 1
esac