Browse Source

updating script for boot/restart

Joseph Snow 8 years ago
parent
commit
af66e39769
2 changed files with 7 additions and 3 deletions
  1. 6 2
      start
  2. 1 1
      util/reboot-restart.sh

+ 6 - 2
start

@@ -3,9 +3,13 @@
 ps waux | grep node | grep -v grep
 
 echo "starting ..."
-## note: start as root, pass env vars to sudo param, this app will downgrade itself once it has initialized
-sudo -E forever app.js &> log.txt &
 
+if [ "$(id -u)" != "0" ]; then
+	## note: start as root, pass env vars to sudo param, this app will downgrade itself once it has initialized
+	sudo -E forever app.js &> log.txt &
+else
+	forever app.js &> log.txt &
+fi
 
 cd etherpad-lite/node
 forever server.js &> log.txt &

+ 1 - 1
util/reboot-restart.sh

@@ -12,6 +12,6 @@ rm /data/db/mongod.lock
 
 pushd .
 cd /home/ec2-user/fc
-cat restart | sudo -u ec2-user sh
+./restart
 popd