ACTION=""
LIST_SERVERS=""
PROMPT=""
+PROMPT_ATTACH=""
PRODUCTION_BRICKS=(
prod-brick01
-p
Prompt to continue or exit between each server
+ -g
+ Prompt to continue or exit before attaching a server.
+ This is useful for testing a server before putting it
+ back into rotation.
+
USAGE
exit
}
fi
fi
+ if [ -n "$PROMPT_ATTACH" ]; then
+ EG_UPDATER_OPS="$EG_UPDATER_OPS -g"
+ fi
+
if [ -z "$LIST_SERVERS" -a -z "$EG_UPDATER_OPS" ]; then
usage;
fi
}
-while getopts "c:e:a:s:lp" opt; do
+while getopts "c:e:a:s:lpg" opt; do
case $opt in
c) CLUSTER="$OPTARG";;
e) EG_UPDATER_OPS="$OPTARG";;
a) ACTION="$OPTARG";;
l) LIST_SERVERS="1";;
p) PROMPT="1";;
+ g) PROMPT_ATTACH="1";;
s) SERVER="$OPTARG";;
h|*) usage;
esac
else
+ echo "Server(s): ${SERVERS[*]}"
+ echo "Action: eg-updater.sh $EG_UPDATER_OPS"
+ echo ""
+ echo "Enter to continue; Control-c to exit"
+ echo ""
+ read X
+
last_index=$((( ${#SERVERS[@]} - 1 )))
for index in "${!SERVERS[@]}"; do
START_ONLY=""
ATTACH_ONLY=""
DETACH_ONLY=""
+CONFIRM_ATTACH=""
# if the script exits early, SUCCESS will be left as 0,
# which is our sign to warn the user.
useful if there is no desire to manually test the brick
after the update. The default is to leave detached.
+ -g
+ Prompt to continue before attaching. This is useful for
+ testing a server before putting it back into rotation.
+
-n
Do not stop/start Apache. This is useful for non-brick
servers, like SIP, etc. servers.
trap on_exit EXIT;
-while getopts "t:b:r:s:i:f:panwchxoklmuv" opt; do
+while getopts "t:b:r:s:i:f:pagnwchxoklmuv" opt; do
case $opt in
a) REATTACH="YES";;
b) GIT_BRANCH="$OPTARG";;
c) REBUILD="YES";;
f) START_SLEEP="$OPTARG";;
+ g) CONFIRM_ATTACH="YES";;
i) CLIENT_SERIES_ID="$OPTARG";;
k) STAFF_CLIENT_ONLY="YES";;
l) STOP_ONLY="YES";;
fi
if [ -f $PING_FILE- -a -z "$STOP_ONLY" ]; then # we detached
- if [ -n "$REATTACH" ]; then
+ if [ -n "$REATTACH" -o -n "$CONFIRM_ATTACH" ]; then
if [ -z "$ATTACH_ONLY" ]; then
- announce "Sleeping $START_SLEEP seconds before attach"
- sleep $START_SLEEP;
+ if [ -n "$CONFIRM_ATTACH" ]; then
+ announce "Press 'Enter' to attach server. Control-c to exit."
+ read X
+ else
+ announce "Sleeping $START_SLEEP seconds before attach"
+ sleep $START_SLEEP;
+ fi
fi
announce "Attaching brick"
$OSRF mv $PING_FILE- $PING_FILE