Difference between revisions of "SQWareCentral:sybase"
Expdbtools (talk | contribs) (→sqwc_GenRefDbSybase.ksh) |
m (Updated by BatchUser) |
||
(16 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
== auto == | == auto == | ||
− | === | + | === sqwsyb_AdddbSQWareProfile.ksh === |
− | + | Action script $gvsqw_RootexpdbCentral/action/sybase/auto/sqwsyb_AdddbSQWareProfile.ksh:<br> | |
− | + | Can be replaced by $gvsqw_RootexpdbCentral/action/sybase/auto_cust/sqwsyb_AdddbSQWareProfile.ksh.<br> | |
− | + | Add dbSQWare profile | |
<br><br> | <br><br> | ||
− | + | Action: | |
<pre> | <pre> | ||
lfsqw_Action() | lfsqw_Action() | ||
{ | { | ||
− | + | while read lvsqw_HostName lvsqw_UserName lvsqw_Instance | |
− | $ | + | do |
− | + | echo "${c_info}$lvsqw_UserName@$lvsqw_HostName $lvsqw_Instance${c_normal}" | |
− | + | lvsqw_Instance=$(echo "$lvsqw_Instance"|cut -d':' -f1) | |
− | + | ssh $gvsqw_SshOptions $lvsqw_UserName@$lvsqw_HostName <<EOFSSH | |
− | + | if [ -r ~/.profile ] | |
− | + | then | |
+ | if [ \$(grep -c 'gvsqw_SybBin' ~/.profile) -eq 0 ] | ||
+ | then | ||
+ | cat <<EOFCAT >>~/.profile | ||
+ | |||
+ | #dbSQWare | ||
+ | export gvsqw_Env='' | ||
+ | export gvsqw_SybBin=\\\$HOME/SQWareProduction/sybase/bin | ||
+ | lvsqw_IsTerminal=\\\$(tty 2>&1 >/dev/null;echo \\\$?) | ||
+ | if [ "\\\$lvsqw_IsTerminal" = "0" ] && [ -r \\\$gvsqw_SybBin/../etc/.profile_confort ] | ||
+ | then | ||
+ | . \\\$gvsqw_SybBin/../etc/.profile_confort | ||
+ | fi | ||
+ | |||
+ | EOFCAT | ||
+ | fi | ||
+ | elif [ -r ~/.bash_profile ] | ||
+ | then | ||
+ | if [ \$(grep -c 'gvsqw_SybBin' ~/.bash_profile) -eq 0 ] | ||
+ | then | ||
+ | cat <<EOFCAT >>~/.bash_profile | ||
+ | |||
+ | #dbSQWare | ||
+ | export gvsqw_Env='' | ||
+ | export gvsqw_SybBin=\\\$HOME/SQWareProduction/sybase/bin | ||
+ | lvsqw_IsTerminal=\\\$(tty 2>&1 >/dev/null;echo \\\$?) | ||
+ | if [ "\\\$lvsqw_IsTerminal" = "0" ] && [ -r \\\$gvsqw_SybBin/../etc/.profile_confort ] | ||
+ | then | ||
+ | . \\\$gvsqw_SybBin/../etc/.profile_confort | ||
+ | fi | ||
− | |||
− | |||
− | |||
− | |||
− | |||
EOFCAT | EOFCAT | ||
+ | fi | ||
+ | fi | ||
EOFSSH | EOFSSH | ||
− | |||
done <$gvsqw_TmpFile.lst | done <$gvsqw_TmpFile.lst | ||
− | + | ||
} | } | ||
</pre> | </pre> | ||
<br> | <br> | ||
=== sqwsyb_DeplScripts.ksh === | === sqwsyb_DeplScripts.ksh === | ||
− | + | Action script $gvsqw_RootexpdbCentral/action/sybase/auto/sqwsyb_DeplScripts.ksh:<br> | |
− | + | Can be replaced by $gvsqw_RootexpdbCentral/action/sybase/auto_cust/sqwsyb_DeplScripts.ksh.<br> | |
− | + | SQWareProduction deployment for Sybase | |
<br><br> | <br><br> | ||
− | + | Action: | |
<pre> | <pre> | ||
lfsqw_Action() | lfsqw_Action() | ||
Line 42: | Line 67: | ||
do | do | ||
echo "${c_info}$lvsqw_UserName@$lvsqw_HostName${c_normal}" | echo "${c_info}$lvsqw_UserName@$lvsqw_HostName${c_normal}" | ||
− | ssh | + | ssh $gvsqw_SshOptions $lvsqw_UserName@$lvsqw_HostName <<EOFSSH |
mkdir -p $gvsqw_RootSQWareProductionSybase/$gvsqw_VersDeplSQWareProductionSybase | mkdir -p $gvsqw_RootSQWareProductionSybase/$gvsqw_VersDeplSQWareProductionSybase | ||
cd $gvsqw_RootSQWareProductionSybase | cd $gvsqw_RootSQWareProductionSybase | ||
− | ln - | + | rm -f $gvsqw_VersSQWareProductionSybase |
+ | ln -s $gvsqw_VersDeplSQWareProductionSybase $gvsqw_VersSQWareProductionSybase | ||
EOFSSH | EOFSSH | ||
rsync -aHv $gvsqw_RsyncPathSybase --delete $gvsqw_RootSQWareProduction/sybase/$gvsqw_VersDeplSQWareProductionSybase $lvsqw_UserName@$lvsqw_HostName:$gvsqw_RootSQWareProductionSybase/. | rsync -aHv $gvsqw_RsyncPathSybase --delete $gvsqw_RootSQWareProduction/sybase/$gvsqw_VersDeplSQWareProductionSybase $lvsqw_UserName@$lvsqw_HostName:$gvsqw_RootSQWareProductionSybase/. | ||
done <$gvsqw_TmpFile.lst | done <$gvsqw_TmpFile.lst | ||
+ | } | ||
+ | </pre> | ||
+ | <br> | ||
+ | === sqwsyb_GatherDistFsSize.ksh === | ||
+ | Action script $gvsqw_RootexpdbCentral/action/sybase/auto/sqwsyb_GatherDistFsSize.ksh:<br> | ||
+ | Can be replaced by $gvsqw_RootexpdbCentral/action/sybase/auto_cust/sqwsyb_GatherDistFsSize.ksh.<br> | ||
+ | Gather FS size | ||
+ | <br><br> | ||
+ | Action: | ||
+ | <pre> | ||
+ | lfsqw_Action() | ||
+ | { | ||
+ | while read lvsqw_HostName lvsqw_UserName lvsqw_Instance | ||
+ | do | ||
+ | echo "${c_info}$lvsqw_UserName@$lvsqw_HostName $lvsqw_Instance${c_normal}" | ||
+ | ssh $gvsqw_SshOptions $gvsqw_DistSQWareProdUser_sybase <<EOFSSH & | ||
+ | \$gvsqw_SybBin/sqwsyb_GatherDistantFsSize.ksh -S "$lvsqw_Instance" -U "$lvsqw_UserName" -H "$lvsqw_HostName" | ||
+ | EOFSSH | ||
+ | sleep 3 | ||
+ | done <$gvsqw_TmpFile.lst | ||
+ | jobs | ||
+ | wait | ||
+ | } | ||
+ | </pre> | ||
+ | <br> | ||
+ | === sqwsyb_GatherIndicatorsDist.ksh === | ||
+ | Action script $gvsqw_RootexpdbCentral/action/sybase/auto/sqwsyb_GatherIndicatorsDist.ksh:<br> | ||
+ | Can be replaced by $gvsqw_RootexpdbCentral/action/sybase/auto_cust/sqwsyb_GatherIndicatorsDist.ksh.<br> | ||
+ | Sybase indicators collection in distant mode | ||
+ | <br><br> | ||
+ | Action: | ||
+ | <pre> | ||
+ | lfsqw_Action() | ||
+ | { | ||
+ | while read lvsqw_HostName lvsqw_UserName lvsqw_Instance | ||
+ | do | ||
+ | echo "${c_info}$lvsqw_UserName@$lvsqw_HostName $lvsqw_Instance${c_normal}" | ||
+ | ssh $gvsqw_SshOptions $gvsqw_DistSQWareProdUser_sybase <<EOFSSH & | ||
+ | \$gvsqw_SybBin/sqwsyb_GatherIndicators.ksh -S "$lvsqw_Instance" -Dist | ||
+ | EOFSSH | ||
+ | sleep 1 | ||
+ | done <$gvsqw_TmpFile.lst | ||
+ | jobs | ||
+ | wait | ||
} | } | ||
</pre> | </pre> | ||
<br> | <br> | ||
=== sqwsyb_GatherIndicators.ksh === | === sqwsyb_GatherIndicators.ksh === | ||
− | + | Action script $gvsqw_RootexpdbCentral/action/sybase/auto/sqwsyb_GatherIndicators.ksh:<br> | |
− | + | Can be replaced by $gvsqw_RootexpdbCentral/action/sybase/auto_cust/sqwsyb_GatherIndicators.ksh.<br> | |
− | + | Sybase indicators collection | |
<br><br> | <br><br> | ||
− | + | Action: | |
<pre> | <pre> | ||
lfsqw_Action() | lfsqw_Action() | ||
Line 63: | Line 133: | ||
while read lvsqw_HostName lvsqw_UserName lvsqw_Instance | while read lvsqw_HostName lvsqw_UserName lvsqw_Instance | ||
do | do | ||
+ | lvsqw_Instance=$(echo "$lvsqw_Instance"|cut -d':' -f1) | ||
echo "${c_info}$lvsqw_UserName@$lvsqw_HostName $lvsqw_Instance${c_normal}" | echo "${c_info}$lvsqw_UserName@$lvsqw_HostName $lvsqw_Instance${c_normal}" | ||
− | ssh | + | ssh $gvsqw_SshOptions $lvsqw_UserName@$lvsqw_HostName <<EOFSSH & |
− | . ./. | + | . \$gvsqw_SybBin/../tools/sqwsyb_SetEnv.ksh $lvsqw_Instance |
− | + | \$gvsqw_SybBin/sqwsyb_RunJob.ksh -S $lvsqw_Instance -A IndicDba | |
− | |||
− | |||
EOFSSH | EOFSSH | ||
sleep 1 | sleep 1 | ||
done <$gvsqw_TmpFile.lst | done <$gvsqw_TmpFile.lst | ||
wait | wait | ||
+ | } | ||
+ | </pre> | ||
+ | <br> | ||
+ | === sqwsyb_Gen_dbSQWare.ksh === | ||
+ | Action script $gvsqw_RootexpdbCentral/action/sybase/auto/sqwsyb_Gen_dbSQWare.ksh:<br> | ||
+ | Can be replaced by $gvsqw_RootexpdbCentral/action/sybase/auto_cust/sqwsyb_Gen_dbSQWare.ksh.<br> | ||
+ | generate dbSQWare files | ||
+ | <br><br> | ||
+ | Action: | ||
+ | <pre> | ||
+ | lfsqw_Action() | ||
+ | { | ||
+ | while read lvsqw_HostName lvsqw_UserName lvsqw_Instance | ||
+ | do | ||
+ | lvsqw_Instance=$(echo "$lvsqw_Instance"|cut -d':' -f1) | ||
+ | echo "${c_info}$lvsqw_UserName@$lvsqw_HostName $lvsqw_Instance${c_normal}" | ||
+ | ssh $gvsqw_SshOptions $lvsqw_UserName@$lvsqw_HostName <<EOFSSH | ||
+ | . \$gvsqw_SybBin/../tools/sqwsyb_SetEnv.ksh $lvsqw_Instance | ||
+ | if [ "\$DSQUERY" != "$lvsqw_Instance" ] | ||
+ | then | ||
+ | export DSQUERY="$lvsqw_Instance" | ||
+ | fi | ||
+ | \$gvsqw_SybBin/../tools/sqwsyb_GenerateCreateDataserver.ksh -dbsOnly <<EOF | ||
+ | y | ||
+ | EOF | ||
+ | EOFSSH | ||
+ | done <$gvsqw_TmpFile.lst | ||
+ | } | ||
+ | </pre> | ||
+ | <br> | ||
+ | === sqwsyb_GenSshKeysInstance.ksh === | ||
+ | Action script $gvsqw_RootexpdbCentral/action/sybase/auto/sqwsyb_GenSshKeysInstance.ksh:<br> | ||
+ | Can be replaced by $gvsqw_RootexpdbCentral/action/sybase/auto_cust/sqwsyb_GenSshKeysInstance.ksh.<br> | ||
+ | ssh keys deployment for Sybase | ||
+ | <br><br> | ||
+ | Action: | ||
+ | <pre> | ||
+ | lfsqw_Action() | ||
+ | { | ||
+ | |||
+ | echo "#########################################################################" | ||
+ | echo "#Create/Retrieve key for SQWareCentral" | ||
+ | mkdir -p $HOME/tmp | ||
+ | if [ -r $HOME/.ssh/id_dsa.pub ] | ||
+ | then | ||
+ | echo "Id DSA found:" | ||
+ | ls -l $HOME/.ssh/id_dsa.pub | ||
+ | lvsqw_CentralKey=$(cat $HOME/.ssh/id_dsa.pub) | ||
+ | elif [ -r $HOME/.ssh/id_rsa.pub ] | ||
+ | then | ||
+ | echo "Id RSA found:" | ||
+ | ls -l $HOME/.ssh/id_rsa.pub | ||
+ | lvsqw_CentralKey=$(cat $HOME/.ssh/id_rsa.pub) | ||
+ | else | ||
+ | ssh-keygen -t rsa -N '' -f $HOME/.ssh/id_rsa | ||
+ | lvsqw_CentralKey=$(cat $HOME/.ssh/id_rsa.pub) | ||
+ | fi | ||
+ | #Retrieve additionnal keys if found (your windows key for exemple) | ||
+ | if [ -r $HOME/.ssh/id_dbSQWare.pub ] | ||
+ | then | ||
+ | echo "Id dbSQWare found:" | ||
+ | ls -l $HOME/.ssh/id_dbSQWare.pub | ||
+ | lvsqw_AdditionnalKey=$(cat $HOME/.ssh/id_dbSQWare.pub) | ||
+ | else | ||
+ | lvsqw_AdditionnalKey="" | ||
+ | fi | ||
+ | chmod go-w $HOME | ||
+ | touch $HOME/.ssh/authorized_keys | ||
+ | chmod 700 $HOME/.ssh | ||
+ | chmod 600 $HOME/.ssh/authorized_keys | ||
+ | echo "${c_menu}#########################################################################" | ||
+ | echo "#create key if not found and put SQWareCentral key for distant users" | ||
+ | echo "Enter password when necessary${c_normal}" | ||
+ | while read lvsqw_HostName lvsqw_UserName lvsqw_Instance | ||
+ | do | ||
+ | echo "" | ||
+ | echo "${c_info}$lvsqw_UserName@$lvsqw_HostName${c_normal}" | ||
+ | ssh -o StrictHostKeyChecking=no $lvsqw_UserName@$lvsqw_HostName <<EOFSSH | ||
+ | mkdir -p \$HOME/tmp | ||
+ | if [ -r \$HOME/.ssh/id_dsa.pub ] | ||
+ | then | ||
+ | echo "Id DSA found:" | ||
+ | ls -l \$HOME/.ssh/id_dsa.pub | ||
+ | cat \$HOME/.ssh/id_dsa.pub | ||
+ | elif [ -r \$HOME/.ssh/id_rsa.pub ] | ||
+ | then | ||
+ | echo "Id RSA found:" | ||
+ | ls -l \$HOME/.ssh/id_rsa.pub | ||
+ | cat \$HOME/.ssh/id_rsa.pub | ||
+ | else | ||
+ | ssh-keygen -t rsa -N '' -f \$HOME/.ssh/id_rsa | ||
+ | cat \$HOME/.ssh/id_rsa.pub | ||
+ | fi | ||
+ | chmod go-w \$HOME | ||
+ | echo "$lvsqw_CentralKey" >>\$HOME/.ssh/authorized_keys | ||
+ | echo "$lvsqw_AdditionnalKey" >>\$HOME/.ssh/authorized_keys | ||
+ | chmod 700 \$HOME/.ssh | ||
+ | chmod 600 \$HOME/.ssh/authorized_keys | ||
+ | EOFSSH | ||
+ | |||
+ | done <$gvsqw_TmpFile.lst | ||
+ | } | ||
+ | </pre> | ||
+ | <br> | ||
+ | === sqwsyb_GenSshKeys.ksh === | ||
+ | Action script $gvsqw_RootexpdbCentral/action/sybase/auto/sqwsyb_GenSshKeys.ksh:<br> | ||
+ | Can be replaced by $gvsqw_RootexpdbCentral/action/sybase/auto_cust/sqwsyb_GenSshKeys.ksh.<br> | ||
+ | ssh keys deployment for Sybase | ||
+ | <br><br> | ||
+ | Action: | ||
+ | <pre> | ||
+ | lfsqw_Action() | ||
+ | { | ||
+ | |||
+ | echo "#########################################################################" | ||
+ | echo "#Create/Retrieve key for SQWareCentral" | ||
+ | mkdir -p $HOME/tmp | ||
+ | if [ -r $HOME/.ssh/id_dsa.pub ] | ||
+ | then | ||
+ | echo "Id DSA found:" | ||
+ | ls -l $HOME/.ssh/id_dsa.pub | ||
+ | lvsqw_CentralKey=$(cat $HOME/.ssh/id_dsa.pub) | ||
+ | elif [ -r $HOME/.ssh/id_rsa.pub ] | ||
+ | then | ||
+ | echo "Id RSA found:" | ||
+ | ls -l $HOME/.ssh/id_rsa.pub | ||
+ | lvsqw_CentralKey=$(cat $HOME/.ssh/id_rsa.pub) | ||
+ | else | ||
+ | ssh-keygen -t rsa -N '' -f $HOME/.ssh/id_rsa | ||
+ | lvsqw_CentralKey=$(cat $HOME/.ssh/id_rsa.pub) | ||
+ | fi | ||
+ | #Retrieve additionnal keys if found (your windows key for exemple) | ||
+ | if [ -r $HOME/.ssh/id_dbSQWare.pub ] | ||
+ | then | ||
+ | echo "Id dbSQWare found:" | ||
+ | ls -l $HOME/.ssh/id_dbSQWare.pub | ||
+ | lvsqw_AdditionnalKey=$(cat $HOME/.ssh/id_dbSQWare.pub) | ||
+ | else | ||
+ | lvsqw_AdditionnalKey="" | ||
+ | fi | ||
+ | chmod go-w $HOME | ||
+ | touch $HOME/.ssh/authorized_keys | ||
+ | chmod 700 $HOME/.ssh | ||
+ | chmod 600 $HOME/.ssh/authorized_keys | ||
+ | echo "${c_menu}#########################################################################" | ||
+ | echo "#create key if not found and put SQWareCentral key for distant users" | ||
+ | echo "Enter password when necessary${c_normal}" | ||
+ | while read lvsqw_HostName lvsqw_UserName | ||
+ | do | ||
+ | echo "" | ||
+ | echo "${c_info}$lvsqw_UserName@$lvsqw_HostName${c_normal}" | ||
+ | ssh -o StrictHostKeyChecking=no $lvsqw_UserName@$lvsqw_HostName <<EOFSSH | ||
+ | mkdir -p \$HOME/tmp | ||
+ | if [ -r \$HOME/.ssh/id_dsa.pub ] | ||
+ | then | ||
+ | echo "Id DSA found:" | ||
+ | ls -l \$HOME/.ssh/id_dsa.pub | ||
+ | cat \$HOME/.ssh/id_dsa.pub | ||
+ | elif [ -r \$HOME/.ssh/id_rsa.pub ] | ||
+ | then | ||
+ | echo "Id RSA found:" | ||
+ | ls -l \$HOME/.ssh/id_rsa.pub | ||
+ | cat \$HOME/.ssh/id_rsa.pub | ||
+ | else | ||
+ | ssh-keygen -t rsa -N '' -f \$HOME/.ssh/id_rsa | ||
+ | cat \$HOME/.ssh/id_rsa.pub | ||
+ | fi | ||
+ | chmod go-w \$HOME | ||
+ | echo "$lvsqw_CentralKey" >>\$HOME/.ssh/authorized_keys | ||
+ | echo "$lvsqw_AdditionnalKey" >>\$HOME/.ssh/authorized_keys | ||
+ | chmod 700 \$HOME/.ssh | ||
+ | chmod 600 \$HOME/.ssh/authorized_keys | ||
+ | EOFSSH | ||
+ | |||
+ | done <$gvsqw_TmpFile.lst | ||
} | } | ||
</pre> | </pre> | ||
Line 79: | Line 323: | ||
== etc == | == etc == | ||
+ | === CrontabRef.cfg === | ||
+ | Configuration file $gvsqw_RootexpdbCentral/action/sybase/etc/CrontabRef.cfg:<br> | ||
+ | It contains the operating variables of SQWareCentral for sybase.<br> | ||
+ | If you want to overload default variables,<br> | ||
+ | put in $gvsqw_RootexpdbCentral/action/sybase/etc_cust/CrontabRef.cfg<br> | ||
+ | your modifications (only variables you want to modify).<br> | ||
+ | <br> | ||
+ | File content: | ||
+ | <pre> | ||
+ | </pre> | ||
+ | <br> | ||
+ | <br> | ||
+ | Variable explanation: | ||
+ | <pre> | ||
+ | </pre> | ||
+ | <br> | ||
=== sqwc_DbRefVar.cfg === | === sqwc_DbRefVar.cfg === | ||
− | + | Configuration file $gvsqw_RootexpdbCentral/action/sybase/etc/sqwc_DbRefVar.cfg:<br> | |
− | + | It contains the operating variables of SQWareCentral for sybase.<br> | |
− | + | If you want to overload default variables,<br> | |
− | + | put in $gvsqw_RootexpdbCentral/action/sybase/etc_cust/sqwc_DbRefVar.cfg<br> | |
− | + | your modifications (only variables you want to modify).<br> | |
− | + | <br> | |
− | + | File content: | |
− | + | <pre> | |
− | + | export gvsqw_DbRefType_sybase='sybase' | |
+ | export gvsqw_DbRefPort_sybase='InstancePortForSybase' | ||
+ | export gvsqw_DbRefInstance_sybase='InstanceNameForSybase' | ||
+ | export gvsqw_DbRefDatabase_sybase='DatabaseInstanceNameForSybase' | ||
+ | export gvsqw_DbRefUser_sybase='ConnexionUserForSybase' | ||
+ | export gvsqw_DbRefPass_sybase='ConnexionPassForSybase' | ||
+ | </pre> | ||
+ | <br> | ||
+ | <br> | ||
+ | Variable explanation: | ||
+ | <pre> | ||
+ | gvsqw_DbRefDatabase_sybase => | ||
+ | gvsqw_DbRefInstance_sybase => | ||
+ | gvsqw_DbRefPass_sybase => | ||
+ | gvsqw_DbRefPort_sybase => | ||
+ | gvsqw_DbRefType_sybase => | ||
+ | gvsqw_DbRefUser_sybase => | ||
+ | </pre> | ||
<br> | <br> | ||
=== sqwc_ExpVar.cfg === | === sqwc_ExpVar.cfg === | ||
− | + | Configuration file $gvsqw_RootexpdbCentral/action/sybase/etc/sqwc_ExpVar.cfg:<br> | |
− | + | It contains the operating variables of SQWareCentral for sybase.<br> | |
− | + | If you want to overload default variables,<br> | |
− | + | put in $gvsqw_RootexpdbCentral/action/sybase/etc_cust/sqwc_ExpVar.cfg<br> | |
− | + | your modifications (only variables you want to modify).<br> | |
− | + | <br> | |
− | + | File content: | |
− | + | <pre> | |
+ | export gvsqw_RootexpdbExpSybase="~$gvsqw_UserUniqueSybase/SQWareProduction/sybase" | ||
+ | export gvsqw_VersexpdbExpSybase='prod' | ||
+ | export gvsqw_VersDeplexpdbExpSybase='v3.1' | ||
+ | export gvsqw_Mail_sybase='dba' | ||
+ | export gvsqw_MailMsg_sybase='TrtSybAuto' | ||
+ | </pre> | ||
+ | <br> | ||
+ | <br> | ||
+ | Variable explanation: | ||
+ | <pre> | ||
+ | gvsqw_MailMsg_sybase => | ||
+ | gvsqw_Mail_sybase => | ||
+ | gvsqw_RootexpdbExpSybase => | ||
+ | gvsqw_VersDeplexpdbExpSybase => | ||
+ | gvsqw_VersexpdbExpSybase => | ||
+ | </pre> | ||
<br> | <br> | ||
=== sqwc_GlobalVar.cfg === | === sqwc_GlobalVar.cfg === | ||
− | + | Configuration file $gvsqw_RootexpdbCentral/action/sybase/etc/sqwc_GlobalVar.cfg:<br> | |
− | + | It contains the operating variables of SQWareCentral for sybase.<br> | |
− | + | If you want to overload default variables,<br> | |
− | + | put in $gvsqw_RootexpdbCentral/action/sybase/etc_cust/sqwc_GlobalVar.cfg<br> | |
+ | your modifications (only variables you want to modify).<br> | ||
+ | <br> | ||
+ | File content: | ||
+ | <pre> | ||
+ | export gvsqw_Mail_sybase='default@dbsqware.com' | ||
+ | export gvsqw_MailMsg_sybase='TrtSybAuto' | ||
+ | export gvsqw_UserUniqueSybase='dbsqware' | ||
+ | export gvsqw_RootSQWareProductionSybase="~$gvsqw_UserUniqueSybase/SQWareProduction/sybase" | ||
+ | export gvsqw_VersSQWareProductionSybase='prod' | ||
+ | export gvsqw_VersDeplSQWareProductionSybase='v3.1' | ||
+ | export gvsqw_DistSQWareProdUser_sybase="$gvsqw_UserUniqueSybase@$gvsqw_Hostname" | ||
+ | </pre> | ||
+ | <br> | ||
+ | <br> | ||
+ | Variable explanation: | ||
+ | <pre> | ||
+ | gvsqw_DistSQWareProdUser_sybase => | ||
+ | gvsqw_MailMsg_sybase => | ||
+ | gvsqw_Mail_sybase => | ||
+ | gvsqw_RootSQWareProductionSybase => | ||
+ | gvsqw_UserUniqueSybase => | ||
+ | gvsqw_VersDeplSQWareProductionSybase => | ||
+ | gvsqw_VersSQWareProductionSybase => | ||
+ | </pre> | ||
<br> | <br> | ||
=== .profile_confort === | === .profile_confort === | ||
− | + | File to put aliases $gvsqw_RootexpdbCentral/action/sybase/etc/.profile_confort:<br> | |
− | + | Contains confort aliases of SQWareCentral for RDBMS sybase.<br> | |
− | + | <br> | |
+ | Alias explanation: | ||
+ | <pre> | ||
act_syb => 'cd $gvsqw_RootexpdbCentral/action/sybase/prod;ls -al' | act_syb => 'cd $gvsqw_RootexpdbCentral/action/sybase/prod;ls -al' | ||
− | depl_syb => '$gvsqw_RootexpdbCentral/bin/sqwc_TrtAuto.ksh sybase | + | etc_syb => 'cd $gvsqw_RootexpdbCentral/action/sybase/etc;ls -al' |
+ | lst_syb => 'cd $gvsqw_RootexpdbCentral/action/sybase/lst;ls -al' | ||
+ | auto_syb => 'cd $gvsqw_RootexpdbCentral/action/sybase/auto;ls -al' | ||
+ | cetc_syb => 'cd $gvsqw_RootexpdbCentral/action/sybase/etc_cust;ls -al' | ||
+ | clst_syb => 'cd $gvsqw_RootexpdbCentral/action/sybase/lst_cust;ls -al' | ||
+ | cauto_syb => 'cd $gvsqw_RootexpdbCentral/action/sybase/auto_cust;ls -al' | ||
+ | depl_syb => '$gvsqw_RootexpdbCentral/menu/sqwc_MenuAction.ksh sybase sqwsyb_DeplScripts.ksh sqwsyb_GenLstUnique.ksh' | ||
+ | repind_syb => '$gvsqw_RootexpdbCentral/bin/sqwc_TrtAuto.ksh sybase sqwsyb_GatherIndicators.ksh sqwsyb_GenLstRepind.ksh NOLOG' | ||
+ | repind_syb_dist => '$gvsqw_RootexpdbCentral/bin/sqwc_TrtAuto.ksh sybase sqwsyb_GatherIndicatorsDist.ksh sqwsyb_GenLstRepindDist.ksh NOLOG' | ||
gen_syb => '$gvsqw_RootexpdbCentral/action/sybase/lst/sqwc_GenRefSybase.ksh' | gen_syb => '$gvsqw_RootexpdbCentral/action/sybase/lst/sqwc_GenRefSybase.ksh' | ||
− | + | gen_int => '$gvsqw_RootexpdbCentral/action/sybase/lst/sqwc_GenInterfaces.ksh' | |
+ | menu_syb => '$gvsqw_RootexpdbCentral/menu/sqwc_MenuAction.ksh sybase' | ||
+ | </pre> | ||
<br> | <br> | ||
<br><br> | <br><br> | ||
== lst == | == lst == | ||
+ | === sqwc_Extract_CMDB_Sybase.ksh === | ||
+ | List generator $gvsqw_RootexpdbCentral/action/sybase/lst/sqwc_Extract_CMDB_Sybase.ksh:<br> | ||
+ | Can be replaced by $gvsqw_RootexpdbCentral/action/sybase/lst_cust/sqwc_Extract_CMDB_Sybase.ksh.<br> | ||
+ | <br><br> | ||
+ | Query used: | ||
+ | <pre> | ||
+ | select 'SYB;' || ref.DataServer || ';' || isnull(lic.Hostname,ref.Hostname)|| ';' || ref.Env || ';' || ref.Status || ';' || | ||
+ | from tsqw_Repository ref | ||
+ | on (ref.DataServer = hist.DataServer and hist.Month=convert(smalldatetime,'01'+substring(convert(char(10),getdate(),103),3,8),103)) | ||
+ | on (hist.DataServer = inf.DataServer and hist.Gather_date = inf.Gather_date) | ||
+ | order by 1 | ||
+ | </pre> | ||
+ | <br> | ||
+ | === sqwc_GenInterfaces.ksh === | ||
+ | List generator $gvsqw_RootexpdbCentral/action/sybase/lst/sqwc_GenInterfaces.ksh:<br> | ||
+ | Can be replaced by $gvsqw_RootexpdbCentral/action/sybase/lst_cust/sqwc_GenInterfaces.ksh.<br> | ||
+ | <br><br> | ||
+ | Query used: | ||
+ | <pre> | ||
+ | echo "# interfaces file generated by SQWareCentral (module of dbSQWare) from SQWareRepository" > $lvsqw_FicRef | ||
+ | select '#'+Env+', '+Client+', '+Contact+', '+Comments+char(10) | ||
+ | from tsqw_Repository | ||
+ | where Status!='OFF' | ||
+ | order by DataServer | ||
+ | </pre> | ||
+ | <br> | ||
=== sqwc_GenRefDbSybase.ksh === | === sqwc_GenRefDbSybase.ksh === | ||
− | + | List generator $gvsqw_RootexpdbCentral/action/sybase/lst/sqwc_GenRefDbSybase.ksh:<br> | |
− | + | Can be replaced by $gvsqw_RootexpdbCentral/action/sybase/lst_cust/sqwc_GenRefDbSybase.ksh.<br> | |
− | |||
− | |||
− | |||
− | |||
<br><br> | <br><br> | ||
− | + | Query used: | |
<pre> | <pre> | ||
select 'SYB;' + vol.DataServer + ';' + vol.Database_name + ';' + ref.Env + ';' + | select 'SYB;' + vol.DataServer + ';' + vol.Database_name + ';' + ref.Env + ';' + | ||
− | |||
− | |||
from tsqw_Repository ref, tsqw_VolDb vol, tsqw_GenHisto hist | from tsqw_Repository ref, tsqw_VolDb vol, tsqw_GenHisto hist | ||
where hist.Month = convert(smalldatetime,'01'+substring(convert(char(10),getdate(),103),3,8),103) | where hist.Month = convert(smalldatetime,'01'+substring(convert(char(10),getdate(),103),3,8),103) | ||
Line 142: | Line 491: | ||
</pre> | </pre> | ||
<br> | <br> | ||
− | |||
=== sqwc_GenRefSybase.ksh === | === sqwc_GenRefSybase.ksh === | ||
− | + | List generator $gvsqw_RootexpdbCentral/action/sybase/lst/sqwc_GenRefSybase.ksh:<br> | |
− | + | Can be replaced by $gvsqw_RootexpdbCentral/action/sybase/lst_cust/sqwc_GenRefSybase.ksh.<br> | |
− | |||
− | |||
− | |||
− | |||
<br><br> | <br><br> | ||
− | + | Query used: | |
<pre> | <pre> | ||
− | select convert(char(18),Virt_Hostname) "VirtHost", | + | select convert(char(18),Virt_Hostname) "VirtHost", |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
from tsqw_Repository | from tsqw_Repository | ||
− | + | select convert(char(18),Virt_Hostname) "VirtHost", | |
− | select convert(char(18),Virt_Hostname) "VirtHost", | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
from tsqw_RepositoryOther | from tsqw_RepositoryOther | ||
order by 6,2,1,3,4 | order by 6,2,1,3,4 | ||
</pre> | </pre> | ||
<br> | <br> | ||
− | + | === sqwsyb_GenLstDataserverDist.ksh === | |
+ | List generator $gvsqw_RootexpdbCentral/action/sybase/lst/sqwsyb_GenLstDataserverDist.ksh:<br> | ||
+ | Can be replaced by $gvsqw_RootexpdbCentral/action/sybase/lst_cust/sqwsyb_GenLstDataserverDist.ksh.<br> | ||
+ | Generation of the list of Sybase dataservers for distant connection (tsqw_Repository) | ||
+ | <br><br> | ||
+ | Query used: | ||
+ | <pre> | ||
+ | select convert(varchar(70),Virt_Hostname+' '+Username+' '+DataServer) | ||
+ | from tsqw_Repository | ||
+ | where Status in ('DIST','MIX') | ||
+ | order by Virt_Hostname, Username | ||
+ | </pre> | ||
+ | <br> | ||
=== sqwsyb_GenLstDataserver.ksh === | === sqwsyb_GenLstDataserver.ksh === | ||
− | + | List generator $gvsqw_RootexpdbCentral/action/sybase/lst/sqwsyb_GenLstDataserver.ksh:<br> | |
− | + | Can be replaced by $gvsqw_RootexpdbCentral/action/sybase/lst_cust/sqwsyb_GenLstDataserver.ksh.<br> | |
− | Generation | + | Generation of the list of Sybase dataservers (tsqw_Repository) |
+ | <br><br> | ||
+ | Query used: | ||
+ | <pre> | ||
+ | select convert(varchar(70),Virt_Hostname+' '+Username+' '+DataServer) | ||
+ | from tsqw_Repository | ||
+ | where Status in ('ON','MIX') | ||
+ | order by Virt_Hostname, Username | ||
+ | </pre> | ||
+ | <br> | ||
+ | === sqwsyb_GenLstDataserverSsh.ksh === | ||
+ | List generator $gvsqw_RootexpdbCentral/action/sybase/lst/sqwsyb_GenLstDataserverSsh.ksh:<br> | ||
+ | Can be replaced by $gvsqw_RootexpdbCentral/action/sybase/lst_cust/sqwsyb_GenLstDataserverSsh.ksh.<br> | ||
+ | Generation of the list of Sybase dataservers for ssh connection | ||
+ | <br><br> | ||
+ | Query used: | ||
+ | <pre> | ||
+ | select convert(varchar(70),ref.Virt_Hostname+' '+cust.Username+' '+ref.DataServer) | ||
+ | from tsqw_Repository ref, tsqw_UserSsh cust | ||
+ | where ref.Status != 'OFF' | ||
+ | and cust.Status = 'ON' | ||
+ | and ref.DataServer = cust.DataServer | ||
+ | order by ref.Virt_Hostname, cust.Username | ||
+ | </pre> | ||
+ | <br> | ||
+ | === sqwsyb_GenLstDataserverSshNew.ksh === | ||
+ | List generator $gvsqw_RootexpdbCentral/action/sybase/lst/sqwsyb_GenLstDataserverSshNew.ksh:<br> | ||
+ | Can be replaced by $gvsqw_RootexpdbCentral/action/sybase/lst_cust/sqwsyb_GenLstDataserverSshNew.ksh.<br> | ||
+ | Generation of the list of Sybase dataservers for ssh connection | ||
<br><br> | <br><br> | ||
− | + | Query used: | |
+ | <pre> | ||
+ | select convert(varchar(70),ref.Virt_Hostname+' '+cust.Username+' '+ref.DataServer) | ||
+ | from tsqw_Repository ref, tsqw_UserSsh cust | ||
+ | where ref.Status != 'OFF' | ||
+ | and cust.Status = 'NEW' | ||
+ | and ref.DataServer = cust.DataServer | ||
+ | order by ref.Virt_Hostname, cust.Username | ||
+ | </pre> | ||
+ | <br> | ||
+ | === sqwsyb_GenLstNewDataserver.ksh === | ||
+ | List generator $gvsqw_RootexpdbCentral/action/sybase/lst/sqwsyb_GenLstNewDataserver.ksh:<br> | ||
+ | Can be replaced by $gvsqw_RootexpdbCentral/action/sybase/lst_cust/sqwsyb_GenLstNewDataserver.ksh.<br> | ||
+ | Generation of the list of Sybase new dataservers (tsqw_Repository) | ||
+ | <br><br> | ||
+ | Query used: | ||
<pre> | <pre> | ||
select convert(varchar(70),Virt_Hostname+' '+Username+' '+DataServer) | select convert(varchar(70),Virt_Hostname+' '+Username+' '+DataServer) | ||
from tsqw_Repository | from tsqw_Repository | ||
− | where Status = ' | + | where Status = 'NEW' |
order by Virt_Hostname, Username | order by Virt_Hostname, Username | ||
</pre> | </pre> | ||
<br> | <br> | ||
− | === | + | === sqwsyb_GenLstNewUnique.ksh === |
− | + | List generator $gvsqw_RootexpdbCentral/action/sybase/lst/sqwsyb_GenLstNewUnique.ksh:<br> | |
− | + | Can be replaced by $gvsqw_RootexpdbCentral/action/sybase/lst_cust/sqwsyb_GenLstNewUnique.ksh.<br> | |
− | Generation | + | Generation of the new user unique list (tsqw_Repository) |
<br><br> | <br><br> | ||
− | + | Query used: | |
<pre> | <pre> | ||
− | select distinct | + | select distinct Hostname||' $gvsqw_UserUniqueSybase' |
from tsqw_Repository | from tsqw_Repository | ||
− | where Status = ' | + | where Status = 'NEW' |
+ | </pre> | ||
+ | <br> | ||
+ | === sqwsyb_GenLstRepindDist.ksh === | ||
+ | List generator $gvsqw_RootexpdbCentral/action/sybase/lst/sqwsyb_GenLstRepindDist.ksh:<br> | ||
+ | Can be replaced by $gvsqw_RootexpdbCentral/action/sybase/lst_cust/sqwsyb_GenLstRepindDist.ksh.<br> | ||
+ | Generation of the list for reprise of indicators (tsqw_Repository/tsqw_GenHisto) | ||
+ | <br><br> | ||
+ | Query used: | ||
+ | <pre> | ||
+ | select convert(varchar(70),ref.Virt_Hostname+' '+ref.Username+' '+ref.DataServer) | ||
+ | from tsqw_Repository ref | ||
+ | where ref.Status in ('DIST','MIX') | ||
+ | and not exists ( select 1 from tsqw_GenHisto inf | ||
+ | where inf.Gather_date = convert(smalldatetime,convert(char(10),getdate(),103),103) | ||
+ | and ref.DataServer = inf.DataServer) | ||
order by Virt_Hostname, Username | order by Virt_Hostname, Username | ||
</pre> | </pre> | ||
<br> | <br> | ||
=== sqwsyb_GenLstRepind.ksh === | === sqwsyb_GenLstRepind.ksh === | ||
− | + | List generator $gvsqw_RootexpdbCentral/action/sybase/lst/sqwsyb_GenLstRepind.ksh:<br> | |
− | + | Can be replaced by $gvsqw_RootexpdbCentral/action/sybase/lst_cust/sqwsyb_GenLstRepind.ksh.<br> | |
− | Generation | + | Generation of the list for reprise of indicators (tsqw_Repository/tsqw_GenHisto) |
<br><br> | <br><br> | ||
− | + | Query used: | |
<pre> | <pre> | ||
select convert(varchar(70),ref.Virt_Hostname+' '+ref.Username+' '+ref.DataServer) | select convert(varchar(70),ref.Virt_Hostname+' '+ref.Username+' '+ref.DataServer) | ||
from tsqw_Repository ref | from tsqw_Repository ref | ||
− | where ref.Status | + | where ref.Status in ('ON','MIX') |
and not exists ( select 1 from tsqw_GenHisto inf | and not exists ( select 1 from tsqw_GenHisto inf | ||
where inf.Gather_date = convert(smalldatetime,convert(char(10),getdate(),103),103) | where inf.Gather_date = convert(smalldatetime,convert(char(10),getdate(),103),103) | ||
+ | and ref.DataServer = inf.DataServer) | ||
order by Virt_Hostname, Username | order by Virt_Hostname, Username | ||
</pre> | </pre> | ||
<br> | <br> | ||
=== sqwsyb_GenLstUnique.ksh === | === sqwsyb_GenLstUnique.ksh === | ||
− | + | List generator $gvsqw_RootexpdbCentral/action/sybase/lst/sqwsyb_GenLstUnique.ksh:<br> | |
− | + | Can be replaced by $gvsqw_RootexpdbCentral/action/sybase/lst_cust/sqwsyb_GenLstUnique.ksh.<br> | |
− | Generation | + | Generation of the user unique list (tsqw_Repository/tsqw_RepositoryOther) |
<br><br> | <br><br> | ||
− | + | Query used: | |
<pre> | <pre> | ||
select distinct Hostname||' $gvsqw_UserUniqueSybase' | select distinct Hostname||' $gvsqw_UserUniqueSybase' | ||
from tsqw_Repository | from tsqw_Repository | ||
− | where Status | + | where Status in ('ON','MIX') |
select distinct Hostname||' $gvsqw_UserUniqueSybase' | select distinct Hostname||' $gvsqw_UserUniqueSybase' | ||
from tsqw_RepositoryOther | from tsqw_RepositoryOther |
Latest revision as of 22:53, 17 December 2012
Contents
- 1 auto
- 2 etc
- 3 lst
- 3.1 sqwc_Extract_CMDB_Sybase.ksh
- 3.2 sqwc_GenInterfaces.ksh
- 3.3 sqwc_GenRefDbSybase.ksh
- 3.4 sqwc_GenRefSybase.ksh
- 3.5 sqwsyb_GenLstDataserverDist.ksh
- 3.6 sqwsyb_GenLstDataserver.ksh
- 3.7 sqwsyb_GenLstDataserverSsh.ksh
- 3.8 sqwsyb_GenLstDataserverSshNew.ksh
- 3.9 sqwsyb_GenLstNewDataserver.ksh
- 3.10 sqwsyb_GenLstNewUnique.ksh
- 3.11 sqwsyb_GenLstRepindDist.ksh
- 3.12 sqwsyb_GenLstRepind.ksh
- 3.13 sqwsyb_GenLstUnique.ksh
auto
sqwsyb_AdddbSQWareProfile.ksh
Action script $gvsqw_RootexpdbCentral/action/sybase/auto/sqwsyb_AdddbSQWareProfile.ksh:
Can be replaced by $gvsqw_RootexpdbCentral/action/sybase/auto_cust/sqwsyb_AdddbSQWareProfile.ksh.
Add dbSQWare profile
Action:
lfsqw_Action() { while read lvsqw_HostName lvsqw_UserName lvsqw_Instance do echo "${c_info}$lvsqw_UserName@$lvsqw_HostName $lvsqw_Instance${c_normal}" lvsqw_Instance=$(echo "$lvsqw_Instance"|cut -d':' -f1) ssh $gvsqw_SshOptions $lvsqw_UserName@$lvsqw_HostName <<EOFSSH if [ -r ~/.profile ] then if [ \$(grep -c 'gvsqw_SybBin' ~/.profile) -eq 0 ] then cat <<EOFCAT >>~/.profile #dbSQWare export gvsqw_Env='' export gvsqw_SybBin=\\\$HOME/SQWareProduction/sybase/bin lvsqw_IsTerminal=\\\$(tty 2>&1 >/dev/null;echo \\\$?) if [ "\\\$lvsqw_IsTerminal" = "0" ] && [ -r \\\$gvsqw_SybBin/../etc/.profile_confort ] then . \\\$gvsqw_SybBin/../etc/.profile_confort fi EOFCAT fi elif [ -r ~/.bash_profile ] then if [ \$(grep -c 'gvsqw_SybBin' ~/.bash_profile) -eq 0 ] then cat <<EOFCAT >>~/.bash_profile #dbSQWare export gvsqw_Env='' export gvsqw_SybBin=\\\$HOME/SQWareProduction/sybase/bin lvsqw_IsTerminal=\\\$(tty 2>&1 >/dev/null;echo \\\$?) if [ "\\\$lvsqw_IsTerminal" = "0" ] && [ -r \\\$gvsqw_SybBin/../etc/.profile_confort ] then . \\\$gvsqw_SybBin/../etc/.profile_confort fi EOFCAT fi fi EOFSSH done <$gvsqw_TmpFile.lst }
sqwsyb_DeplScripts.ksh
Action script $gvsqw_RootexpdbCentral/action/sybase/auto/sqwsyb_DeplScripts.ksh:
Can be replaced by $gvsqw_RootexpdbCentral/action/sybase/auto_cust/sqwsyb_DeplScripts.ksh.
SQWareProduction deployment for Sybase
Action:
lfsqw_Action() { while read lvsqw_HostName lvsqw_UserName do echo "${c_info}$lvsqw_UserName@$lvsqw_HostName${c_normal}" ssh $gvsqw_SshOptions $lvsqw_UserName@$lvsqw_HostName <<EOFSSH mkdir -p $gvsqw_RootSQWareProductionSybase/$gvsqw_VersDeplSQWareProductionSybase cd $gvsqw_RootSQWareProductionSybase rm -f $gvsqw_VersSQWareProductionSybase ln -s $gvsqw_VersDeplSQWareProductionSybase $gvsqw_VersSQWareProductionSybase EOFSSH rsync -aHv $gvsqw_RsyncPathSybase --delete $gvsqw_RootSQWareProduction/sybase/$gvsqw_VersDeplSQWareProductionSybase $lvsqw_UserName@$lvsqw_HostName:$gvsqw_RootSQWareProductionSybase/. done <$gvsqw_TmpFile.lst }
sqwsyb_GatherDistFsSize.ksh
Action script $gvsqw_RootexpdbCentral/action/sybase/auto/sqwsyb_GatherDistFsSize.ksh:
Can be replaced by $gvsqw_RootexpdbCentral/action/sybase/auto_cust/sqwsyb_GatherDistFsSize.ksh.
Gather FS size
Action:
lfsqw_Action() { while read lvsqw_HostName lvsqw_UserName lvsqw_Instance do echo "${c_info}$lvsqw_UserName@$lvsqw_HostName $lvsqw_Instance${c_normal}" ssh $gvsqw_SshOptions $gvsqw_DistSQWareProdUser_sybase <<EOFSSH & \$gvsqw_SybBin/sqwsyb_GatherDistantFsSize.ksh -S "$lvsqw_Instance" -U "$lvsqw_UserName" -H "$lvsqw_HostName" EOFSSH sleep 3 done <$gvsqw_TmpFile.lst jobs wait }
sqwsyb_GatherIndicatorsDist.ksh
Action script $gvsqw_RootexpdbCentral/action/sybase/auto/sqwsyb_GatherIndicatorsDist.ksh:
Can be replaced by $gvsqw_RootexpdbCentral/action/sybase/auto_cust/sqwsyb_GatherIndicatorsDist.ksh.
Sybase indicators collection in distant mode
Action:
lfsqw_Action() { while read lvsqw_HostName lvsqw_UserName lvsqw_Instance do echo "${c_info}$lvsqw_UserName@$lvsqw_HostName $lvsqw_Instance${c_normal}" ssh $gvsqw_SshOptions $gvsqw_DistSQWareProdUser_sybase <<EOFSSH & \$gvsqw_SybBin/sqwsyb_GatherIndicators.ksh -S "$lvsqw_Instance" -Dist EOFSSH sleep 1 done <$gvsqw_TmpFile.lst jobs wait }
sqwsyb_GatherIndicators.ksh
Action script $gvsqw_RootexpdbCentral/action/sybase/auto/sqwsyb_GatherIndicators.ksh:
Can be replaced by $gvsqw_RootexpdbCentral/action/sybase/auto_cust/sqwsyb_GatherIndicators.ksh.
Sybase indicators collection
Action:
lfsqw_Action() { while read lvsqw_HostName lvsqw_UserName lvsqw_Instance do lvsqw_Instance=$(echo "$lvsqw_Instance"|cut -d':' -f1) echo "${c_info}$lvsqw_UserName@$lvsqw_HostName $lvsqw_Instance${c_normal}" ssh $gvsqw_SshOptions $lvsqw_UserName@$lvsqw_HostName <<EOFSSH & . \$gvsqw_SybBin/../tools/sqwsyb_SetEnv.ksh $lvsqw_Instance \$gvsqw_SybBin/sqwsyb_RunJob.ksh -S $lvsqw_Instance -A IndicDba EOFSSH sleep 1 done <$gvsqw_TmpFile.lst wait }
sqwsyb_Gen_dbSQWare.ksh
Action script $gvsqw_RootexpdbCentral/action/sybase/auto/sqwsyb_Gen_dbSQWare.ksh:
Can be replaced by $gvsqw_RootexpdbCentral/action/sybase/auto_cust/sqwsyb_Gen_dbSQWare.ksh.
generate dbSQWare files
Action:
lfsqw_Action() { while read lvsqw_HostName lvsqw_UserName lvsqw_Instance do lvsqw_Instance=$(echo "$lvsqw_Instance"|cut -d':' -f1) echo "${c_info}$lvsqw_UserName@$lvsqw_HostName $lvsqw_Instance${c_normal}" ssh $gvsqw_SshOptions $lvsqw_UserName@$lvsqw_HostName <<EOFSSH . \$gvsqw_SybBin/../tools/sqwsyb_SetEnv.ksh $lvsqw_Instance if [ "\$DSQUERY" != "$lvsqw_Instance" ] then export DSQUERY="$lvsqw_Instance" fi \$gvsqw_SybBin/../tools/sqwsyb_GenerateCreateDataserver.ksh -dbsOnly <<EOF y EOF EOFSSH done <$gvsqw_TmpFile.lst }
sqwsyb_GenSshKeysInstance.ksh
Action script $gvsqw_RootexpdbCentral/action/sybase/auto/sqwsyb_GenSshKeysInstance.ksh:
Can be replaced by $gvsqw_RootexpdbCentral/action/sybase/auto_cust/sqwsyb_GenSshKeysInstance.ksh.
ssh keys deployment for Sybase
Action:
lfsqw_Action() { echo "#########################################################################" echo "#Create/Retrieve key for SQWareCentral" mkdir -p $HOME/tmp if [ -r $HOME/.ssh/id_dsa.pub ] then echo "Id DSA found:" ls -l $HOME/.ssh/id_dsa.pub lvsqw_CentralKey=$(cat $HOME/.ssh/id_dsa.pub) elif [ -r $HOME/.ssh/id_rsa.pub ] then echo "Id RSA found:" ls -l $HOME/.ssh/id_rsa.pub lvsqw_CentralKey=$(cat $HOME/.ssh/id_rsa.pub) else ssh-keygen -t rsa -N '' -f $HOME/.ssh/id_rsa lvsqw_CentralKey=$(cat $HOME/.ssh/id_rsa.pub) fi #Retrieve additionnal keys if found (your windows key for exemple) if [ -r $HOME/.ssh/id_dbSQWare.pub ] then echo "Id dbSQWare found:" ls -l $HOME/.ssh/id_dbSQWare.pub lvsqw_AdditionnalKey=$(cat $HOME/.ssh/id_dbSQWare.pub) else lvsqw_AdditionnalKey="" fi chmod go-w $HOME touch $HOME/.ssh/authorized_keys chmod 700 $HOME/.ssh chmod 600 $HOME/.ssh/authorized_keys echo "${c_menu}#########################################################################" echo "#create key if not found and put SQWareCentral key for distant users" echo "Enter password when necessary${c_normal}" while read lvsqw_HostName lvsqw_UserName lvsqw_Instance do echo "" echo "${c_info}$lvsqw_UserName@$lvsqw_HostName${c_normal}" ssh -o StrictHostKeyChecking=no $lvsqw_UserName@$lvsqw_HostName <<EOFSSH mkdir -p \$HOME/tmp if [ -r \$HOME/.ssh/id_dsa.pub ] then echo "Id DSA found:" ls -l \$HOME/.ssh/id_dsa.pub cat \$HOME/.ssh/id_dsa.pub elif [ -r \$HOME/.ssh/id_rsa.pub ] then echo "Id RSA found:" ls -l \$HOME/.ssh/id_rsa.pub cat \$HOME/.ssh/id_rsa.pub else ssh-keygen -t rsa -N '' -f \$HOME/.ssh/id_rsa cat \$HOME/.ssh/id_rsa.pub fi chmod go-w \$HOME echo "$lvsqw_CentralKey" >>\$HOME/.ssh/authorized_keys echo "$lvsqw_AdditionnalKey" >>\$HOME/.ssh/authorized_keys chmod 700 \$HOME/.ssh chmod 600 \$HOME/.ssh/authorized_keys EOFSSH done <$gvsqw_TmpFile.lst }
sqwsyb_GenSshKeys.ksh
Action script $gvsqw_RootexpdbCentral/action/sybase/auto/sqwsyb_GenSshKeys.ksh:
Can be replaced by $gvsqw_RootexpdbCentral/action/sybase/auto_cust/sqwsyb_GenSshKeys.ksh.
ssh keys deployment for Sybase
Action:
lfsqw_Action() { echo "#########################################################################" echo "#Create/Retrieve key for SQWareCentral" mkdir -p $HOME/tmp if [ -r $HOME/.ssh/id_dsa.pub ] then echo "Id DSA found:" ls -l $HOME/.ssh/id_dsa.pub lvsqw_CentralKey=$(cat $HOME/.ssh/id_dsa.pub) elif [ -r $HOME/.ssh/id_rsa.pub ] then echo "Id RSA found:" ls -l $HOME/.ssh/id_rsa.pub lvsqw_CentralKey=$(cat $HOME/.ssh/id_rsa.pub) else ssh-keygen -t rsa -N '' -f $HOME/.ssh/id_rsa lvsqw_CentralKey=$(cat $HOME/.ssh/id_rsa.pub) fi #Retrieve additionnal keys if found (your windows key for exemple) if [ -r $HOME/.ssh/id_dbSQWare.pub ] then echo "Id dbSQWare found:" ls -l $HOME/.ssh/id_dbSQWare.pub lvsqw_AdditionnalKey=$(cat $HOME/.ssh/id_dbSQWare.pub) else lvsqw_AdditionnalKey="" fi chmod go-w $HOME touch $HOME/.ssh/authorized_keys chmod 700 $HOME/.ssh chmod 600 $HOME/.ssh/authorized_keys echo "${c_menu}#########################################################################" echo "#create key if not found and put SQWareCentral key for distant users" echo "Enter password when necessary${c_normal}" while read lvsqw_HostName lvsqw_UserName do echo "" echo "${c_info}$lvsqw_UserName@$lvsqw_HostName${c_normal}" ssh -o StrictHostKeyChecking=no $lvsqw_UserName@$lvsqw_HostName <<EOFSSH mkdir -p \$HOME/tmp if [ -r \$HOME/.ssh/id_dsa.pub ] then echo "Id DSA found:" ls -l \$HOME/.ssh/id_dsa.pub cat \$HOME/.ssh/id_dsa.pub elif [ -r \$HOME/.ssh/id_rsa.pub ] then echo "Id RSA found:" ls -l \$HOME/.ssh/id_rsa.pub cat \$HOME/.ssh/id_rsa.pub else ssh-keygen -t rsa -N '' -f \$HOME/.ssh/id_rsa cat \$HOME/.ssh/id_rsa.pub fi chmod go-w \$HOME echo "$lvsqw_CentralKey" >>\$HOME/.ssh/authorized_keys echo "$lvsqw_AdditionnalKey" >>\$HOME/.ssh/authorized_keys chmod 700 \$HOME/.ssh chmod 600 \$HOME/.ssh/authorized_keys EOFSSH done <$gvsqw_TmpFile.lst }
etc
CrontabRef.cfg
Configuration file $gvsqw_RootexpdbCentral/action/sybase/etc/CrontabRef.cfg:
It contains the operating variables of SQWareCentral for sybase.
If you want to overload default variables,
put in $gvsqw_RootexpdbCentral/action/sybase/etc_cust/CrontabRef.cfg
your modifications (only variables you want to modify).
File content:
Variable explanation:
sqwc_DbRefVar.cfg
Configuration file $gvsqw_RootexpdbCentral/action/sybase/etc/sqwc_DbRefVar.cfg:
It contains the operating variables of SQWareCentral for sybase.
If you want to overload default variables,
put in $gvsqw_RootexpdbCentral/action/sybase/etc_cust/sqwc_DbRefVar.cfg
your modifications (only variables you want to modify).
File content:
export gvsqw_DbRefType_sybase='sybase' export gvsqw_DbRefPort_sybase='InstancePortForSybase' export gvsqw_DbRefInstance_sybase='InstanceNameForSybase' export gvsqw_DbRefDatabase_sybase='DatabaseInstanceNameForSybase' export gvsqw_DbRefUser_sybase='ConnexionUserForSybase' export gvsqw_DbRefPass_sybase='ConnexionPassForSybase'
Variable explanation:
gvsqw_DbRefDatabase_sybase => gvsqw_DbRefInstance_sybase => gvsqw_DbRefPass_sybase => gvsqw_DbRefPort_sybase => gvsqw_DbRefType_sybase => gvsqw_DbRefUser_sybase =>
sqwc_ExpVar.cfg
Configuration file $gvsqw_RootexpdbCentral/action/sybase/etc/sqwc_ExpVar.cfg:
It contains the operating variables of SQWareCentral for sybase.
If you want to overload default variables,
put in $gvsqw_RootexpdbCentral/action/sybase/etc_cust/sqwc_ExpVar.cfg
your modifications (only variables you want to modify).
File content:
export gvsqw_RootexpdbExpSybase="~$gvsqw_UserUniqueSybase/SQWareProduction/sybase" export gvsqw_VersexpdbExpSybase='prod' export gvsqw_VersDeplexpdbExpSybase='v3.1' export gvsqw_Mail_sybase='dba' export gvsqw_MailMsg_sybase='TrtSybAuto'
Variable explanation:
gvsqw_MailMsg_sybase => gvsqw_Mail_sybase => gvsqw_RootexpdbExpSybase => gvsqw_VersDeplexpdbExpSybase => gvsqw_VersexpdbExpSybase =>
sqwc_GlobalVar.cfg
Configuration file $gvsqw_RootexpdbCentral/action/sybase/etc/sqwc_GlobalVar.cfg:
It contains the operating variables of SQWareCentral for sybase.
If you want to overload default variables,
put in $gvsqw_RootexpdbCentral/action/sybase/etc_cust/sqwc_GlobalVar.cfg
your modifications (only variables you want to modify).
File content:
export gvsqw_Mail_sybase='default@dbsqware.com' export gvsqw_MailMsg_sybase='TrtSybAuto' export gvsqw_UserUniqueSybase='dbsqware' export gvsqw_RootSQWareProductionSybase="~$gvsqw_UserUniqueSybase/SQWareProduction/sybase" export gvsqw_VersSQWareProductionSybase='prod' export gvsqw_VersDeplSQWareProductionSybase='v3.1' export gvsqw_DistSQWareProdUser_sybase="$gvsqw_UserUniqueSybase@$gvsqw_Hostname"
Variable explanation:
gvsqw_DistSQWareProdUser_sybase => gvsqw_MailMsg_sybase => gvsqw_Mail_sybase => gvsqw_RootSQWareProductionSybase => gvsqw_UserUniqueSybase => gvsqw_VersDeplSQWareProductionSybase => gvsqw_VersSQWareProductionSybase =>
.profile_confort
File to put aliases $gvsqw_RootexpdbCentral/action/sybase/etc/.profile_confort:
Contains confort aliases of SQWareCentral for RDBMS sybase.
Alias explanation:
act_syb => 'cd $gvsqw_RootexpdbCentral/action/sybase/prod;ls -al' etc_syb => 'cd $gvsqw_RootexpdbCentral/action/sybase/etc;ls -al' lst_syb => 'cd $gvsqw_RootexpdbCentral/action/sybase/lst;ls -al' auto_syb => 'cd $gvsqw_RootexpdbCentral/action/sybase/auto;ls -al' cetc_syb => 'cd $gvsqw_RootexpdbCentral/action/sybase/etc_cust;ls -al' clst_syb => 'cd $gvsqw_RootexpdbCentral/action/sybase/lst_cust;ls -al' cauto_syb => 'cd $gvsqw_RootexpdbCentral/action/sybase/auto_cust;ls -al' depl_syb => '$gvsqw_RootexpdbCentral/menu/sqwc_MenuAction.ksh sybase sqwsyb_DeplScripts.ksh sqwsyb_GenLstUnique.ksh' repind_syb => '$gvsqw_RootexpdbCentral/bin/sqwc_TrtAuto.ksh sybase sqwsyb_GatherIndicators.ksh sqwsyb_GenLstRepind.ksh NOLOG' repind_syb_dist => '$gvsqw_RootexpdbCentral/bin/sqwc_TrtAuto.ksh sybase sqwsyb_GatherIndicatorsDist.ksh sqwsyb_GenLstRepindDist.ksh NOLOG' gen_syb => '$gvsqw_RootexpdbCentral/action/sybase/lst/sqwc_GenRefSybase.ksh' gen_int => '$gvsqw_RootexpdbCentral/action/sybase/lst/sqwc_GenInterfaces.ksh' menu_syb => '$gvsqw_RootexpdbCentral/menu/sqwc_MenuAction.ksh sybase'
lst
sqwc_Extract_CMDB_Sybase.ksh
List generator $gvsqw_RootexpdbCentral/action/sybase/lst/sqwc_Extract_CMDB_Sybase.ksh:
Can be replaced by $gvsqw_RootexpdbCentral/action/sybase/lst_cust/sqwc_Extract_CMDB_Sybase.ksh.
Query used:
select 'SYB;' || ref.DataServer || ';' || isnull(lic.Hostname,ref.Hostname)|| ';' || ref.Env || ';' || ref.Status || ';' || from tsqw_Repository ref on (ref.DataServer = hist.DataServer and hist.Month=convert(smalldatetime,'01'+substring(convert(char(10),getdate(),103),3,8),103)) on (hist.DataServer = inf.DataServer and hist.Gather_date = inf.Gather_date) order by 1
sqwc_GenInterfaces.ksh
List generator $gvsqw_RootexpdbCentral/action/sybase/lst/sqwc_GenInterfaces.ksh:
Can be replaced by $gvsqw_RootexpdbCentral/action/sybase/lst_cust/sqwc_GenInterfaces.ksh.
Query used:
echo "# interfaces file generated by SQWareCentral (module of dbSQWare) from SQWareRepository" > $lvsqw_FicRef select '#'+Env+', '+Client+', '+Contact+', '+Comments+char(10) from tsqw_Repository where Status!='OFF' order by DataServer
sqwc_GenRefDbSybase.ksh
List generator $gvsqw_RootexpdbCentral/action/sybase/lst/sqwc_GenRefDbSybase.ksh:
Can be replaced by $gvsqw_RootexpdbCentral/action/sybase/lst_cust/sqwc_GenRefDbSybase.ksh.
Query used:
select 'SYB;' + vol.DataServer + ';' + vol.Database_name + ';' + ref.Env + ';' + from tsqw_Repository ref, tsqw_VolDb vol, tsqw_GenHisto hist where hist.Month = convert(smalldatetime,'01'+substring(convert(char(10),getdate(),103),3,8),103) and hist.DataServer = vol.DataServer and hist.Gather_date = vol.Gather_date and ref.DataServer = hist.DataServer and ref.Status!='OFF' and vol.Database_name not in ('dbccdb','master','tempdb','sybsecurity','sybsystemdb','sybsystemprocs','model','audsa','auditdb','sybmgmtdb') and vol.Database_name not like 'temp%' order by vol.Database_name, vol.DataServer
sqwc_GenRefSybase.ksh
List generator $gvsqw_RootexpdbCentral/action/sybase/lst/sqwc_GenRefSybase.ksh:
Can be replaced by $gvsqw_RootexpdbCentral/action/sybase/lst_cust/sqwc_GenRefSybase.ksh.
Query used:
select convert(char(18),Virt_Hostname) "VirtHost", from tsqw_Repository select convert(char(18),Virt_Hostname) "VirtHost", from tsqw_RepositoryOther order by 6,2,1,3,4
sqwsyb_GenLstDataserverDist.ksh
List generator $gvsqw_RootexpdbCentral/action/sybase/lst/sqwsyb_GenLstDataserverDist.ksh:
Can be replaced by $gvsqw_RootexpdbCentral/action/sybase/lst_cust/sqwsyb_GenLstDataserverDist.ksh.
Generation of the list of Sybase dataservers for distant connection (tsqw_Repository)
Query used:
select convert(varchar(70),Virt_Hostname+' '+Username+' '+DataServer) from tsqw_Repository where Status in ('DIST','MIX') order by Virt_Hostname, Username
sqwsyb_GenLstDataserver.ksh
List generator $gvsqw_RootexpdbCentral/action/sybase/lst/sqwsyb_GenLstDataserver.ksh:
Can be replaced by $gvsqw_RootexpdbCentral/action/sybase/lst_cust/sqwsyb_GenLstDataserver.ksh.
Generation of the list of Sybase dataservers (tsqw_Repository)
Query used:
select convert(varchar(70),Virt_Hostname+' '+Username+' '+DataServer) from tsqw_Repository where Status in ('ON','MIX') order by Virt_Hostname, Username
sqwsyb_GenLstDataserverSsh.ksh
List generator $gvsqw_RootexpdbCentral/action/sybase/lst/sqwsyb_GenLstDataserverSsh.ksh:
Can be replaced by $gvsqw_RootexpdbCentral/action/sybase/lst_cust/sqwsyb_GenLstDataserverSsh.ksh.
Generation of the list of Sybase dataservers for ssh connection
Query used:
select convert(varchar(70),ref.Virt_Hostname+' '+cust.Username+' '+ref.DataServer) from tsqw_Repository ref, tsqw_UserSsh cust where ref.Status != 'OFF' and cust.Status = 'ON' and ref.DataServer = cust.DataServer order by ref.Virt_Hostname, cust.Username
sqwsyb_GenLstDataserverSshNew.ksh
List generator $gvsqw_RootexpdbCentral/action/sybase/lst/sqwsyb_GenLstDataserverSshNew.ksh:
Can be replaced by $gvsqw_RootexpdbCentral/action/sybase/lst_cust/sqwsyb_GenLstDataserverSshNew.ksh.
Generation of the list of Sybase dataservers for ssh connection
Query used:
select convert(varchar(70),ref.Virt_Hostname+' '+cust.Username+' '+ref.DataServer) from tsqw_Repository ref, tsqw_UserSsh cust where ref.Status != 'OFF' and cust.Status = 'NEW' and ref.DataServer = cust.DataServer order by ref.Virt_Hostname, cust.Username
sqwsyb_GenLstNewDataserver.ksh
List generator $gvsqw_RootexpdbCentral/action/sybase/lst/sqwsyb_GenLstNewDataserver.ksh:
Can be replaced by $gvsqw_RootexpdbCentral/action/sybase/lst_cust/sqwsyb_GenLstNewDataserver.ksh.
Generation of the list of Sybase new dataservers (tsqw_Repository)
Query used:
select convert(varchar(70),Virt_Hostname+' '+Username+' '+DataServer) from tsqw_Repository where Status = 'NEW' order by Virt_Hostname, Username
sqwsyb_GenLstNewUnique.ksh
List generator $gvsqw_RootexpdbCentral/action/sybase/lst/sqwsyb_GenLstNewUnique.ksh:
Can be replaced by $gvsqw_RootexpdbCentral/action/sybase/lst_cust/sqwsyb_GenLstNewUnique.ksh.
Generation of the new user unique list (tsqw_Repository)
Query used:
select distinct Hostname||' $gvsqw_UserUniqueSybase' from tsqw_Repository where Status = 'NEW'
sqwsyb_GenLstRepindDist.ksh
List generator $gvsqw_RootexpdbCentral/action/sybase/lst/sqwsyb_GenLstRepindDist.ksh:
Can be replaced by $gvsqw_RootexpdbCentral/action/sybase/lst_cust/sqwsyb_GenLstRepindDist.ksh.
Generation of the list for reprise of indicators (tsqw_Repository/tsqw_GenHisto)
Query used:
select convert(varchar(70),ref.Virt_Hostname+' '+ref.Username+' '+ref.DataServer) from tsqw_Repository ref where ref.Status in ('DIST','MIX') and not exists ( select 1 from tsqw_GenHisto inf where inf.Gather_date = convert(smalldatetime,convert(char(10),getdate(),103),103) and ref.DataServer = inf.DataServer) order by Virt_Hostname, Username
sqwsyb_GenLstRepind.ksh
List generator $gvsqw_RootexpdbCentral/action/sybase/lst/sqwsyb_GenLstRepind.ksh:
Can be replaced by $gvsqw_RootexpdbCentral/action/sybase/lst_cust/sqwsyb_GenLstRepind.ksh.
Generation of the list for reprise of indicators (tsqw_Repository/tsqw_GenHisto)
Query used:
select convert(varchar(70),ref.Virt_Hostname+' '+ref.Username+' '+ref.DataServer) from tsqw_Repository ref where ref.Status in ('ON','MIX') and not exists ( select 1 from tsqw_GenHisto inf where inf.Gather_date = convert(smalldatetime,convert(char(10),getdate(),103),103) and ref.DataServer = inf.DataServer) order by Virt_Hostname, Username
sqwsyb_GenLstUnique.ksh
List generator $gvsqw_RootexpdbCentral/action/sybase/lst/sqwsyb_GenLstUnique.ksh:
Can be replaced by $gvsqw_RootexpdbCentral/action/sybase/lst_cust/sqwsyb_GenLstUnique.ksh.
Generation of the user unique list (tsqw_Repository/tsqw_RepositoryOther)
Query used:
select distinct Hostname||' $gvsqw_UserUniqueSybase' from tsqw_Repository where Status in ('ON','MIX') select distinct Hostname||' $gvsqw_UserUniqueSybase' from tsqw_RepositoryOther order by 1