Bugzilla – Attachment 757 Details for
Bug 968
OpenSSH 3.8p1 PRNG seed extraction failed error
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
deploy korn script that distributes and installs application software on multiple servers.
deploy.sh (text/plain), 14.86 KB, created by
stephen berliner
on 2005-01-04 05:58:08 AEDT
(
hide
)
Description:
deploy korn script that distributes and installs application software on multiple servers.
Filename:
MIME Type:
Creator:
stephen berliner
Created:
2005-01-04 05:58:08 AEDT
Size:
14.86 KB
patch
obsolete
>#! /bin/ksh > > ># >### Thu Oct 14 16:50:34 EDT 2004 ># >### >>>>>>>> DO NOT EDIT THIS FILE. <<<<<<<<<<< >### >### This file is generated by deploy.sh.GEN. >### Any edits will be lost the next time this file is generated. >### Any required changes must be made to the deploy.sh.GEN script >### which is under version control. >### >### >>>>>>>> DO NOT EDIT THIS FILE. <<<<<<<<<<< ># > >#EDGAR_RELEASE=Q8.90.05; export EDGAR_RELEASE >#EDGAR_BLD_DATE=2004-10-14.16:29:11; export EDGAR_BLD_DATE > >##################################################################### ># >### Clears the screen ># >##################################################################### > >clearScreen() >{ > tput clear >} > >##################################################################### ># >### Captures the command to the log file ># >##################################################################### > >output() >{ > $@ 2>&1 | tee -a $LOGFILE >} >##################################################################### ># >### Captures the command to the log file and server log file ># >##################################################################### > >output2() >{ > $@ 2>&1 | tee -a $LOGFILE > $@ >> $LOGPATH/$host.log 2>&1 >} > >##################################################################### ># >### Function to check for the existence of the current tar file ># >##################################################################### > >checkTarFiles() >{ > tmpFailHost="" > tmpHost="" > tmpTars="" > let "i = 0" > while [ $i -lt ${#hostList[*]} ] > do > host=${hostList[$i]} > tarFile=${tarFiles[$i]} > let "i = i + 1" > > rm -f $LOGPATH/$host.log > > if [ ! -e $tarFile.tar ] > then > tmpFailHost="$tmpFailHost $host" > output2 echo "" > output2 echo ERROR: Could not locate $tarFile.tar > output2 echo Skipping installation of $host ... > output2 echo "" > continue > else > output2 echo "" > output2 echo Located $tarFile.tar > output2 echo "" > tmpHost="$tmpHost $host" > tmpTars="$tmpTars $tarFile" > fi > done > set -A failhostList $tmpFailHost > set -A hostList $tmpHost > set -A tarFiles $tmpTars > > >} >##################################################################### ># >### Function to chekc for the existence of KNOWN_HOSTS ># >##################################################################### > >checkServers() >{ > tmpHost="" > tmpTars="" > tmphostPS="" > let "i = 0" > while [ $i -lt ${#hostList[*]} ] > do > host=${hostList[$i]} > tarFile=${tarFiles[$i]} > let "i = i + 1" > output echo "" > output echo Checking for existence of ${host} > output echo "" >telnet $host 22 <<! 2>&1 | tee -a $LOGPATH/$host.log >quit >! > done > let "i = 0" > while [ $i -lt ${#hostList[*]} ] > do > host=${hostList[$i]} > tarFile=${tarFiles[$i]} > let "i = i + 1" > success=`egrep 'Connected' $LOGPATH/$host.log | awk ' {print $1} '` > > case "$success" in > Connected) > success=0 > tmpHost="$tmpHost $host" > tmpTars="$tmpTars $tarFile" > output echo "" > output echo $host Exists > output echo "" > ;; > *) > tmpFailHost="$tmpFailHost $host" > output echo "" > output echo $host does not Exist > output echo "" > ;; > esac > done > set -A failhostList $tmpFailHost > set -A hostList $tmpHost > set -A tarFiles $tmpTars > >} > >##################################################################### ># >### Function to remove the old tar file and >### clean out the old depot. ># >##################################################################### > >cleanTarget() >{ > tmpHost="" > tmpTars="" > tmphostPS="" > old=old > cmDirold="$cmDir$old" > let "i = 0" > while [ $i -lt ${#hostList[*]} ] > do > host=${hostList[$i]} > tarFile=${tarFiles[$i]} > let "i = i + 1" > output echo "" > output echo Removing the old depot on ${userId}@${host} > output echo "" > (ssh $userId@$host "rm -rf $depotDir/* $cmDirold; mv $cmDir $cmDirold; mkdir $cmDir"; echo $host cleanTargetStatus: $?) 2>&1 | tee -a $LOGPATH/$host.log& > export hostps=x$!x > tmphostPS="$tmphostPS$hostps|" > done > pidsUP=`ps -ef | awk '{print "x" $2 "x"}' | egrep $tmphostPS` > while [ "$pidsUP" ] > do > pidsUP=`ps -ef | awk '{print "x" $2 "x"}' | egrep $tmphostPS` > done > let "i = 0" > while [ $i -lt ${#hostList[*]} ] > do > host=${hostList[$i]} > tarFile=${tarFiles[$i]} > let "i = i + 1" > success=`egrep 'cleanTargetStatus:' $LOGPATH/$host.log | awk ' {print $3} '` > > case "$success" in > 0|2) > success=0 > tmpHost="$tmpHost $host" > tmpTars="$tmpTars $tarFile" > output echo "" > output echo $host Clean succeeded > output echo "" > ;; > *) > tmpFailHost="$tmpFailHost $host" > output echo "" > output echo $host Clean failed > output echo "" > ;; > esac > done > set -A failhostList $tmpFailHost > set -A hostList $tmpHost > set -A tarFiles $tmpTars > > >} > >##################################################################### ># >### Function to copy the tar file out to the target host. ># >##################################################################### > >copyTarFile() >{ > tmpHost="" > tmpTars="" > tmphostPS="" > let "i = 0" > while [ $i -lt ${#hostList[*]} ] > do > host=${hostList[$i]} > tarFile=${tarFiles[$i]} > let "i = i + 1" > output echo "" > output echo Copying ${tarFile}.tar to ${userId}@${host} > output echo "" > (scp $tarFile.tar $userId@$host:$cmDir/. ;echo $host copyTarFileStatus: $?) 2>&1 | tee -a $LOGPATH/$host.log& > export hostps=x$!x > tmphostPS="$tmphostPS$hostps|" > done > pidsUP=`ps -ef | awk '{print "x" $2 "x"}' | egrep $tmphostPS` > while [ "$pidsUP" ] > do > pidsUP=`ps -ef | awk '{print "x" $2 "x"}' | egrep $tmphostPS` > done > let "i = 0" > while [ $i -lt ${#hostList[*]} ] > do > host=${hostList[$i]} > tarFile=${tarFiles[$i]} > let "i = i + 1" > success=`egrep 'copyTarFileStatus:' $LOGPATH/$host.log | awk ' {print $3} '` > > case "$success" in > 0) > success=0 > tmpHost="$tmpHost $host" > tmpTars="$tmpTars $tarFile" > output echo "" > output echo $host Copy succeeded > output echo "" > ;; > *) > tmpFailHost="$tmpFailHost $host" > output echo "" > output echo $host Copy failed > output echo "" > ;; > esac > done > set -A failhostList $tmpFailHost > set -A hostList $tmpHost > set -A tarFiles $tmpTars > > >} > >##################################################################### ># >### Function to open the tar file into the depot and install >### the software. ># >##################################################################### > >installDepot() >{ > tmpHost="" > tmpTars="" > tmphostPS="" > let "i = 0" > while [ $i -lt ${#hostList[*]} ] > do > host=${hostList[$i]} > tarFile=${tarFiles[$i]} > let "i = i + 1" > output echo "" > output echo Installing ${userId}@${host} > output echo "" > (ssh $userId@$host "TERM=$TERM; export TERM; cd $depotDir; tar xvf $cmDir/$tarFile.tar; . $depotDir/edgar.kshrc; ./install.sh $installparam" ; echo $host installDepotStatus: $?) >> $LOGPATH/$host.log 2>&1 & > export hostps=x$!x > tmphostPS="$tmphostPS$hostps|" > done > pidsUP=`ps -ef | awk '{print "x" $2 "x"}' | egrep $tmphostPS` > while [ "$pidsUP" ] > do > pidsUP=`ps -ef | awk '{print "x" $2 "x"}' | egrep $tmphostPS` > done > let "i = 0" > while [ $i -lt ${#hostList[*]} ] > do > host=${hostList[$i]} > tarFile=${tarFiles[$i]} > let "i = i + 1" > success=`egrep 'installDepotStatus:' $LOGPATH/$host.log | awk ' {print $3} '` > > case "$success" in > 0|2) > success=0 > tmpHost="$tmpHost $host" > tmpTars="$tmpTars $tarFile" > output echo "" > output echo $host Installation succeeded > output echo "" > ;; > *) > tmpFailHost="$tmpFailHost $host" > output echo "" > output echo $host Installation failed > output echo "" > ;; > esac > done > set -A failhostList $tmpFailHost > set -A hostList $tmpHost > set -A tarFiles $tmpTars > > > >} > >##################################################################### ># >### Function to center the text. ># >##################################################################### > >center() >{ > echo " \c"; >} > >##################################################################### ># >### Function to set variables based on the environment that >### is being installed. >### >### NOTE: The 'hostlist' and 'tarFiles' variables must be kept >### consistent with each other. That is, for each host in >### hostList there must be a respective tar file in tarFiles. >### If you change the order of one, you must change the order >### of the other. ># >##################################################################### > >getEnvironment() >{ > returnCode=0 > > ENVIRONMENT=QA > > userId=qa > homeDir=/home/qa > envDir=/EDGAR_ENV/EDGAR_QA > > for i in FILERWEB3 FILERWEB4 ONLINEWEB3-HQ FORMWEB3-HQ OPSGW2 OPSGW5 OPSGW6-HQ SECSRV4-HQ SECSRV2 RS2 RS4-HQ TMS2 EDR2 LLF2 ACCPT3 ACCPT4 SNA2 > do > case "$i" in > "RS2"|"RS4-HQ"|"") > tmpTars="$tmpTars RS" > ;; > "FILERWEB3"|"FILERWEB4") > tmpTars="$tmpTars FW" > ;; > "FORMWEB3-HQ"|"FORMWEB3-HQ") > tmpTars="$tmpTars FORM" > ;; > "ONLINEWEB3-HQ"|"ONLINEWEB4-HQ") > tmpTars="$tmpTars OW" > ;; > "ACCPT3"|"ACCPT4") > tmpTars="$tmpTars AC" > ;; > "EDR2") > tmpTars="$tmpTars EDR" > ;; > "TMS2") > tmpTars="$tmpTars TMS" > ;; > "OPSGW2"|"OPSGW5"|"OPSGW6-HQ"|"OPSGW6-HQ") > tmpTars="$tmpTars OPS" > ;; > "SECSRV4-HQ"|"SECSRV2") > tmpTars="$tmpTars SS" > ;; > "LLF2") > tmpTars="$tmpTars LL" > ;; > "SNA2") > tmpTars="$tmpTars SNA" > ;; > *) > echo "ERROR: Invalid Host: $i" > returnCode=1 > ;; > esac > done > > set -A hostList FILERWEB3 FILERWEB4 ONLINEWEB3-HQ FORMWEB3-HQ OPSGW2 OPSGW5 OPSGW6-HQ SECSRV4-HQ SECSRV2 RS2 RS4-HQ TMS2 EDR2 LLF2 ACCPT3 ACCPT4 SNA2 > set -A tarFiles $tmpTars > return $returnCode >} > >##################################################################### ># >### Function to interactively get the installation type >### (full or partial) ># >##################################################################### > >getInstallType() >{ >output date >output "" ># >### Ask the user if install should be run as -noprompt or -nomap ># > finished=0 > while [ $finished -ne 1 ] > do > clearScreen > echo; echo; echo; > > > output echo "-nomap: NO forced generation of map files and NO prompt during install." > output echo "-noprompt: forced generation of ALL map files and NO prompt during install." > output echo "" > center > output echo "Run install as [1]-nomap or [2]-noprompt? [1] \c" > read ans > output echo "$ans" > > case $ans in > ""|1) > installparam=-nomap > finished=1 > ;; > > 2) > installparam=-noprompt > finished=1 > ;; > *) > echo Invalid answer: $ans > echo "Press enter to continue -> \c" > read choice > ;; > esac > done > > clearScreen > echo; echo > output echo > center > output echo This is a $installparam installation of Quality Assurance > output echo > ># >### Ask the user for the installation type ># > finished=0 > while [ $finished -ne 1 ] > do > echo; echo; > > center > output echo "Is this a full install of Quality Assurance? [y] \c" > read ans > output echo "$ans" > > case $ans in > ""|y|Y|yes|Yes|YES) > installType=full > finished=1 > ;; > > n|no|N|No|NO) > installType=partial > finished=1 > ;; > *) > echo Invalid answer: $ans > echo "Press enter to continue -> \c" > read choice > ;; > esac > done > > clearScreen > echo; echo > output echo > center > output echo This is a $installType $installparam installation of Quality Assurance > output echo > ># >### If it's a partial installation, show the user the list of >### possible hosts, then ask the user to supply the host list. ># > if [ $installType = "partial" ] > then > tryAgain=1 > firstTime=1 > while [ $tryAgain -eq 1 ] > do > > if [ $firstTime -eq 0 ] > then > clearScreen > echo; echo; echo; echo > fi > firstTime=0 > > tryAgain=0 > echo Valid hostnames are: > echo > for h in ${hostList[*]} > do > echo "$h \c" > done > echo > echo > echo Enter the hosts to install on the next line. Use a space as the separator. > echo "Host List -> \c" > read targets > > set -A targetList $targets > > if [ "$targets" != "" ] > then ># >### The user supplied some hosts. >### Remove duplicates, if any. ># > sortFile=/tmp/`basename $0`.$$ > rm -f $sortFile > for t in ${targetList[*]} > do > echo $t >> $sortFile > done > > set -A targetList `sort -u $sortFile` > rm -f $sortFile > else ># >### No host was supplied ># > tryAgain=1 > fi > ># >### Validate the user supplied host list. >### If any one is invalid make the user try again. >### Create the tarFile array based on the host selections. ># > tmpTarFiles="" > for t in ${targetList[*]} > do > cnt=0 > foundIt=0 > for h in ${hostList[*]} > do > if [ $t = $h ] > then > tmpTarFiles="$tmpTarFiles ${tarFiles[$cnt]}" > foundIt=1 > break > fi > let cnt=$cnt+1 > done > > if [ $foundIt -eq 0 ] > then > echo WARNING: Invalid host name: $t > echo "Hit ENTER to try again -> \c" > read choice > tryAgain=1 > break > fi > done > done > > set -A hostList ${targetList[*]} > set -A tarFiles $tmpTarFiles > fi >} > >##################################################################### ># >### Main body ># >##################################################################### > >LOGPATH=./logs > >if [ ! -d $LOGPATH ] >then > mkdir $LOGPATH >fi > >LOGFILE=$LOGPATH/deploy.log >rm -f $LOGFILE > >getEnvironment > >if [ $? -eq 1 ] >then > output echo "Exiting" > exit >fi > >getInstallType > >output echo "" >output echo You have elected to install the Quality Assurance environment >output echo "" >output echo The following hosts will be installed: >output echo "" >output echo ${hostList[*]} >output echo "" > >output echo "Continue? [y/n] -> \c" >read ans >output echo "$ans" >if [ "$ans" != "y" ] >then > output echo Aborting installation > exit >fi > >if [ "$homeDir" = "" ] >then > output echo homeDir not set > output echo Aborting installation > exit 1 >fi > >if [ "$envDir" = "" ] >then > output echo envDir not set > output echo Aborting installation > exit 1 >fi > >cmDir=$homeDir/cmxfer >depotDir=$envDir/depot > >if [ ${#hostList[*]} != 0 ] >then > checkTarFiles >fi > >if [ ${#hostList[*]} != 0 ] >then > checkServers >fi > >if [ ${#hostList[*]} != 0 ] >then > cleanTarget >fi >if [ ${#hostList[*]} != 0 ] >then > copyTarFile >fi >if [ ${#hostList[*]} != 0 ] >then > installDepot >fi > >if [ ${#hostList[*]} != 0 ] >then > let "i = 0" > while [ $i -lt ${#hostList[*]} ] > do > host=${hostList[$i]} > let "i = i + 1" > output echo "" > output echo Deployment of $host successful. > output echo "" > done >fi > >if [ ${#failhostList[*]} != 0 ] >then > let "i = 0" > while [ $i -lt ${#failhostList[*]} ] > do > host=${failhostList[$i]} > let "i = i + 1" > output echo "" > output echo Deployment of $host failed. > output echo "" > done >fi > >if [ ${#hostList[*]} != 0 ] >then > let "i = 0" > while [ $i -lt ${#hostList[*]} ] > do > host=${hostList[$i]} > let "i = i + 1" > echo "" >> $LOGFILE > cat $LOGPATH/$host.log >> $LOGFILE > echo "" >> $LOGFILE > done >fi > >if [ ${#failhostList[*]} != 0 ] >then > let "i = 0" > while [ $i -lt ${#failhostList[*]} ] > do > host=${failhostList[$i]} > let "i = i + 1" > echo "" >> $LOGFILE > cat $LOGPATH/$host.log >> $LOGFILE > echo "" >> $LOGFILE > done >fi > >output echo "" >output echo Deployment complete >output echo "" >output echo See results in $LOGFILE. >output echo "" >output date
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 968
: 757 |
758
|
759
|
760
|
827
|
828