Index: openacs-4/etc/deploy.sh =================================================================== RCS file: /usr/local/cvsroot/openacs-4/etc/deploy.sh,v diff -u -r1.1 -r1.2 --- openacs-4/etc/deploy.sh 1 Mar 2004 14:13:51 -0000 1.1 +++ openacs-4/etc/deploy.sh 3 Mar 2004 13:18:35 -0000 1.2 @@ -1,43 +1,56 @@ -#!/bin/bash -# should turn this into an /etc/init.d script, with commands: -# status (prod is X, up 100 seconds; alt is Y, down) -# promote X (automatically makes X production and demotes current prod to preprod) +#!/bin/bin/tclsh +# process command line arguments +foreach arg $argv { + switch -glob -- $arg { + --status {set status_p true} + --help* {set help_p true} + --switch* {set switch_p true} + } +} -E_BADARGS=65 -if [ ! -n "$1" ] -then - echo "Usage: `basename $0` Old New " - echo "Current Old:`ls -l /web/ | grep primary`" - echo "Current New:`ls -l /web/ | grep alternate`" - exit $E_BADARGS -fi -PROD=primary -ALT=alternate -BASE_DIR=/var/lib/aolserver -SVC_DIR=/var/lib/svscan -OLD=$1 -NEW=$2 +if { [llength $argv] = 0 } { + set help_p true +} -# basic premise: a server named foo is controlled by daemontools as $SVC_DIR/foo, -# and is actually rooted at BASE_DIR/foo -# when it is moved to production, its config.tcl is updated -# and the BASE_DIR/PROD link is changed to point to it -# and BASE_DIR/ALT is changed to point to whatever it replaced +if { $help_p } { + puts stdout {Usage: deploy [--switch | --status | --help]} + exit +} -svc -d $SVC_DIR/$OLD -svc -d $SVC_DIR/$NEW -cd $BASE_DIR -rm $PROD -rm $ALT -cd $BASE_DIR/$NEW/etc -cvs up -r $PROD config.tcl -cd $BASE_DIR/$OLD/etc -cvs up -r $ALT config.tcl -cd $BASE_DIR -ln -s $NEW $PROD -ln -s $OLD $ALT -svc -u $SVC_DIR/$NEW -svc -u $SVC_DIR/$OLD +if { $status_p } { + set balance_txt [exec /usr/sbin/balance -c show 80] + puts stdout $balance_txt + exit +} -# show status -svstat $SVC_DIR/* +# the old bash script: +# PROD=primary +# ALT=alternate +# BASE_DIR=/var/lib/aolserver +# SVC_DIR=/var/lib/svscan +# OLD=$1 +# NEW=$2 + +# # basic premise: a server named foo is controlled by daemontools as $SVC_DIR/foo, +# # and is actually rooted at BASE_DIR/foo +# # when it is moved to production, its config.tcl is updated +# # and the BASE_DIR/PROD link is changed to point to it +# # and BASE_DIR/ALT is changed to point to whatever it replaced + +# svc -d $SVC_DIR/$OLD +# svc -d $SVC_DIR/$NEW +# cd $BASE_DIR +# rm $PROD +# rm $ALT +# cd $BASE_DIR/$NEW/etc +# cvs up -r $PROD config.tcl +# cd $BASE_DIR/$OLD/etc +# cvs up -r $ALT config.tcl +# cd $BASE_DIR +# ln -s $NEW $PROD +# ln -s $OLD $ALT +# svc -u $SVC_DIR/$NEW +# svc -u $SVC_DIR/$OLD + +# # show status +# svstat $SVC_DIR/*