From: Joseph Snow Date: Tue, 15 Nov 2011 11:22:05 +0000 (-0700) Subject: added reboot-restart.sh script. X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=11583c81acfe187f5c8c2c1fc55c845046d58a06;p=oweals%2Ffinalsclub.git added reboot-restart.sh script. also updated these scripts to s3 --- diff --git a/util/boot.sh b/util/boot.sh index 881b885..bf51f79 100755 --- a/util/boot.sh +++ b/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 diff --git a/util/reboot-restart.sh b/util/reboot-restart.sh new file mode 100644 index 0000000..d358ef4 --- /dev/null +++ b/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 + diff --git a/util/start.sh b/util/start.sh index 2b9d4b0..ed3d5f3 100755 --- a/util/start.sh +++ b/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