added reboot-restart.sh script.
authorJoseph Snow <josephsnow@gmail.com>
Tue, 15 Nov 2011 11:22:05 +0000 (04:22 -0700)
committerJoseph Snow <josephsnow@gmail.com>
Tue, 15 Nov 2011 11:22:05 +0000 (04:22 -0700)
also updated these scripts to s3

util/boot.sh
util/reboot-restart.sh [new file with mode: 0644]
util/start.sh

index 881b8857633db696a5293490d5dcd05315cb7646..bf51f79ad6fb7caecbdffb87742da2abec4c952a 100755 (executable)
@@ -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
 
diff --git a/util/reboot-restart.sh b/util/reboot-restart.sh
new file mode 100644 (file)
index 0000000..d358ef4
--- /dev/null
@@ -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
+
index 2b9d4b0666c91b039839bd5ceca045f5e272a148..ed3d5f3c18f042bcef1f0a563261efce30a1804a 100755 (executable)
@@ -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