start 704 B

1234567891011121314151617181920212223242526272829
  1. #!/bin/bash
  2. # Start Script for running app.js and Etherpad-lite
  3. # Kill all node instances
  4. killall node
  5. # Set Env. Vars.
  6. export NODE_PATH=/home/risci_atom/FinalsClub/etherpad-lite/node_modules:$NODE_PATH
  7. export MONGO_HOST_URI=mongodb://localhost/fc
  8. export MONGO_HOST=localhost
  9. export SERVER_HOST=www.finalsclub.org
  10. export SERVER_PORT=80
  11. export NODE_ENV=production
  12. ps waux | grep node | grep -v grep
  13. echo "starting ..."
  14. cd etherpad-lite/node
  15. forever server.js &> log.txt &
  16. cd ../../
  17. if [ "$(id -u)" != "0" ]; then
  18. ## note: start as root, pass env vars to sudo param, this app will downgrade itself onc$
  19. sudo -E forever app.js &> log.txt &
  20. else
  21. forever app.js &> log.txt &
  22. fi