Browse Source

added reboot-restart.sh script.
also updated these scripts to s3

Joseph Snow 12 years ago
parent
commit
11583c81ac
3 changed files with 26 additions and 5 deletions
  1. 6 1
      util/boot.sh
  2. 17 0
      util/reboot-restart.sh
  3. 3 4
      util/start.sh

+ 6 - 1
util/boot.sh

@@ -32,7 +32,6 @@ if test ! -e mongodb.tgz ; then
 	chmod a+rx *
 	chmod uo-w *
 	cp -f * /usr/local/bin
-	echo "/usr/local/bin &> /var/log/mongod.log &" >> /etc/rc.local
 	mkdir -p /data/db
 	/usr/local/bin/mongod -v --rest --replSet finalsclubset &> /var/log/mongod.log &
 
@@ -86,6 +85,12 @@ chmod 660 haproxy.cfg
 #  sudo /usr/local/haproxy/haproxy -f /usr/local/haproxy/haproxy.cfg -p /var/run/haproxy.pid &
 
 
+## init the reboot-restart.sh script, but don't run it.
+cd ~
+wget https://s3.amazonaws.com/finalsclub.org/reboot-restart.sh
+chmod 755 reboot-restart.sh
+echo "/root/reboot-restart.sh &> /var/log/fc-reboot-restart.log.txt &" >> /etc/rc.local
+	
 
 curl https://s3.amazonaws.com/finalsclub.org/start.sh | sudo -u ec2-user sh
 

+ 17 - 0
util/reboot-restart.sh

@@ -0,0 +1,17 @@
+#!/bin/bash
+
+export PATH="/usr/local/bin:$PATH"
+
+## this script assumes it is running as root
+rm /data/db/mongod.lock
+/usr/local/bin/mongod -v --rest --replSet finalsclubset &> /var/log/mongod.log &
+
+## optional, if arbiter db is running on this machine
+## rm /data/arbiterdb/mongod.lock
+## /usr/local/bin/mongod -v --dbpath /data/arbiterdb --port 27021 --rest --replSet finalsclubset &> /var/log/mongod-arbiter.log &
+
+pushd .
+cd /home/ec2-user/fc
+cat restart | sudo -u ec2-user sh
+popd
+

+ 3 - 4
util/start.sh

@@ -1,9 +1,8 @@
 #!/bin/bash
 
-cd ~
-
 export PATH="/usr/local/bin:$PATH"
 
+cd ~
 rm -rf bc
 git clone git@github.com:finalsclubdev/bc
 cd ~/bc
@@ -12,7 +11,7 @@ npm install socket.io
 npm install express-messages
 npm install jade
 
-
+cd ~
 rm -rf fc
 git clone git@github.com:finalsclubdev/FinalsClub.git
 ln -sf FinalsClub fc
@@ -40,7 +39,7 @@ chmod 775 fcbackup_init.sh
 
 ## start the server
 cd ~/fc
-./restart.sh
+./restart