Permalink
Browse files

CLC-1220 Improvements in how we mark server as offline/online; add up…

…grade routine to init.d script
  • Loading branch information...
1 parent 100334c commit 96c144a272c8abae6b244eef0b16616ff36ee7e3 Chris Tweney committed Feb 15, 2013
Showing with 26 additions and 3 deletions.
  1. +23 −2 script/init.d/calcentral
  2. +2 −0 script/start-trinidad.sh
  3. +1 −1 script/stop-trinidad.sh
View
25 script/init.d/calcentral 100644 → 100755
@@ -11,6 +11,8 @@ START_SCRIPT="$CC_BASE/script/start-trinidad.sh"
STOP_SCRIPT="$CC_BASE/script/stop-trinidad.sh"
BG_START_SCRIPT="$CC_BASE/script/start-backstage.sh"
BG_STOP_SCRIPT="$CC_BASE/script/stop-backstage.sh"
+UPDATE_SCRIPT="$CC_BASE/script/update-build.sh"
+MIGRATE_SCRIPT="$CC_BASE/script/migrate.sh"
DOCROOT="/var/www/html/calcentral"
OFFLINE_FILE="$DOCROOT/calcentral-in-maintenance"
NIGHTLY_HTML="$DOCROOT/index_nightly.html"
@@ -63,6 +65,23 @@ emergency () {
offline
}
+upgrade () {
+ if [ ! -x "$UPDATE_SCRIPT" ]; then
+ echo "$UPDATE_SCRIPT doesn't exist or is not executable"
+ exit 1
+ fi
+ echo "Updating CalCentral code to current version on $REMOTE:$BRANCH"
+ $UPDATE_SCRIPT
+ if [ "X$NODEONE" != "X" ]; then
+ if [ ! -x "$MIGRATE_SCRIPT" ]; then
+ echo "$MIGRATE_SCRIPT doesn't exist or is not executable"
+ exit 1
+ fi
+ echo "Migrating database..."
+ $MIGRATE_SCRIPT
+ start
+ fi
+}
start() {
if [ "X$NODEONE" != "X" ]; then
@@ -110,10 +129,9 @@ status() {
case "$1" in
start)
- start && online
+ start
;;
stop)
- maint
stop
;;
restart)
@@ -139,6 +157,9 @@ case "$1" in
emergency)
emergency
;;
+ upgrade)
+ upgrade
+ ;;
*)
echo "Usage: $0 {start|stop|restart|status|online|offline|nightly|maint|emergency}"
esac
View
2 script/start-trinidad.sh
@@ -27,5 +27,7 @@ nohup trinidad < /dev/null > /dev/null 2> $LOG &
# wait a bit to let server start up
sleep 45
+./script/init.d/calcentral online
+
# now tickle the app to warm it up
curl -i -stderr /dev/null http://localhost:3000/ > /dev/null
View
2 script/stop-trinidad.sh
@@ -7,7 +7,7 @@ LOGIT="tee -a $LOG"
echo "------------------------------------------" | $LOGIT
echo "`date`: Putting CalCentral server in offline mode" | $LOGIT
-touch "/var/www/html/calcentral/calcentral-in-maintenance"
+./script/init.d/calcentral maint
JPS_RESULTS=`jps -mlv | grep bin/trinidad | cut -d ' ' -f 1`
for i in $JPS_RESULTS

0 comments on commit 96c144a

Please sign in to comment.