#!/bin/bash # Start Script for running app.js and Etherpad-lite # Kill all node instances killall node # Set Env. Vars. export NODE_PATH=/home/risci_atom/FinalsClub/etherpad-lite/node_modules:$NODE_PATH export MONGO_HOST_URI=mongodb://localhost/fc export MONGO_HOST=localhost export SERVER_HOST=www.finalsclub.org export SERVER_PORT=80 export NODE_ENV=production ps waux | grep node | grep -v grep echo "starting ..." cd etherpad-lite/node forever server.js &> log.txt & cd ../../ if [ "$(id -u)" != "0" ]; then ## note: start as root, pass env vars to sudo param, this app will downgrade itself onc$ sudo -E forever app.js &> log.txt & else forever app.js &> log.txt & fi