0% found this document useful (0 votes)
76 views8 pages

SCR

This script configures and installs Abinitio software on a server. It performs the following key steps: 1. Checks the hostname and performs cleanup tasks if on a specific server. 2. Configures Abinitio runtime configuration (RC) files and the shared configuration file. It customizes variables, includes the shared file, and sets paths. 3. Prompts for environment variables and paths needed for Abinitio software installations and customizes configuration files accordingly. 4. Installs Abinitio software RPM files by copying them to locations, setting permissions, and exporting environment variables. It tracks what is already installed to skip duplicates.

Uploaded by

KUSHAL SARASWAT
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
76 views8 pages

SCR

This script configures and installs Abinitio software on a server. It performs the following key steps: 1. Checks the hostname and performs cleanup tasks if on a specific server. 2. Configures Abinitio runtime configuration (RC) files and the shared configuration file. It customizes variables, includes the shared file, and sets paths. 3. Prompts for environment variables and paths needed for Abinitio software installations and customizes configuration files accordingly. 4. Installs Abinitio software RPM files by copying them to locations, setting permissions, and exporting environment variables. It tracks what is already installed to skip duplicates.

Uploaded by

KUSHAL SARASWAT
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 8

#!

/usr/bin/ksh
#!/bin/ksh
hstchk=$(hostname)
if [[ ${hstchk} = 'vm-f39f-4fb9' ]];then
rm /abinitio/tmp/envs/*.env
rm .sandbox.pset
cp .sandbox.pset_temp .sandbox.pset
#chmod 777 .sandbox.pset
rm /optware/abinitio-AppHub-V3.2.6.15/config/apphubrc
rm /optware/abinitio-V3.2.6.15/config/abinitiorc
rm /opt/abinitio_config/*
fi

emchk=0
rcfile () {
rcpth=${pth}/config
echo "ORC path >> ${rcpth}"
echo "b>> ${b}"
if [[ ${b} = 'AppHub' ]];then
if [[ ${(find "${rcpth}/apphubrc" | wc -l)} = '0' ]] 2>'/dev/null';then
echo "Apphurc loop"
rcfnm=$(ls -tr ${rcpth}/apphubrc.example |rev|cut -d "/" -f1 |cut -d "." -f2|rev)
echo " Created ${rcfnm} in path ${rcpth}"
touch ${rcpth}/${rcfnm}
cat /abinitio/tmp/apphubrc_temp >> ${rcpth}/${rcfnm} #change
sed -i "s|vr|${v}|g" ${rcpth}/${rcfnm}
aprcpth=$rcpth
else
echo "Apphubrc is present"
fi
else
#elif [[ $(ls -ltr ${rcpth} | grep -i ${a}rc | wc -l = '0') ]];then
if [[ ${( find ${rcpth}/abinitiorc | wc -l)} = '0' ]] 2>'/dev/null';then

echo "checking for shared.abinitio fine in /opt/abinitio_config"


shpth="/opt/abinitio_config/"
if [[ ${(find "${shpth}/shared.abinitiorc" | wc -l)} = '0' ]]
2>'/dev/null';then
echo "Shared.abinitio is not present"
shnt=1
if [[ ${(find "/opt/abinitio_config" | wc -l)} = '0' ]]
2>'/dev/null';then
mkdir "/opt/abinitio_config"
fi
touch "${shpth}/shared.abinitiorc"
echo "Creating Shared.abinitio"
cat "/abinitio/tmp/shared.abinitio_temp" >> "${shpth}/shared.abinitiorc" #change
echo "Creating Hostalias file enter the hostname as mentioned below"
(cat /abinitio/tmp/hostalias_temp) #change
h="${shpth}/hostalias"
touch ${h}
echo "Enter the details make sure Syntax is correct"
z=0
while [[ ${z} = '0' ]];
do
printf "Enter Alias and Hostname "
read -r htn
if [[ ${emchk} = '0' ]];then
printf "Is this your EME Server too? Enter y >> (Yes) or n >> (No) "
read emch
printf "\n"
if [[ ${emch} = 'y' ]];then
emtmp=$( echo ${htn} | cut -d " " -f1 )
printf "Enter EME path also "
read emtpth
sed -i "s|emhst|${emtmp}|g" "${shpth}/shared.abinitiorc"
sed -i "s|empth|${emtpth}|g" "${shpth}/shared.abinitiorc"
emchk=1
printf "\n"
fi
fi

printf "%s\t" ${htn} >> ${h}


printf "\n" >> ${h}
echo " if you have Entered all the hostname Enter y >> (Yes) OR Else n >> (No)"
read -r z
if [[ ${z} = 'n' ]];then
continue
else
break
fi
done
for item in $(cat ${h});do hst=$(cut -f1 | awk '{print}' ORS=' '); sed -i "s|alis|$
{hst}|" "${shpth}/shared.abinitiorc" ;done < ${h}
echo "Enter Control Center URL"
read cc
sed -i "s|ccurl|${cc}|g" "${shpth}/shared.abinitiorc"
sed -i "s|vr|${v}|g" "${shpth}/shared.abinitiorc"
echo "creating abinitiorc 1"
rcfnm=$(ls -tr "${rcpth}/abinitiorc.example" |rev| cut -d "/" -f1|cut -d "." -
f2|rev)
echo "Created ${rcfnm} in path ${rcpth}"
touch "${rcpth}/${rcfnm}"
echo "# system-wide config var settings
@include /opt/abinitio_config/shared.abinitiorc" >> ${rcpth}/${rcfnm}
else
echo "creating abinitiorc 2"
echo "Shared.abinitio is present"
rcfnm=$(ls -tr "${rcpth}/abinitiorc.example" |rev| cut -d "/" -f1|cut -d "." -f2
|rev)
echo " Created ${rcfnm} in path ${rcpth}"
touch "${rcpth}/${rcfnm}"
echo "# system-wide config var settings
@include /opt/abinitio_config/shared.abinitiorc" >> ${rcpth}/${rcfnm}

fi
clear

else
echo "creating abinitiorc 3"
echo "Shared.abinitio is present"
rcfnm=$(ls -tr "${rcpth}/abinitiorc.example" |rev|cut -d "/" -f1| cut -d "." -
f2|rev)
echo " Created ${rcfnm} in path ${rcpth}"
touch "${rcpth}/${rcfnm}"
echo "# system-wide config var settings
@include /opt/abinitio_config/shared.abinitiorc" >> ${rcpth}/${rcfnm}
fi
fi }
stenv () {
printf "################Enter the MFS partition value you need to create for this
Server >> "
read mfs
sed -i "12 s|Line12|"$mfs"|" $(pwd)/.sandbox.pset
(find ${stpth}) 2>'/dev/null'
if [[ $? = '1' ]];then
printf "\n"
tmpstpth=$( echo ${stpth} | rev | cut -d "/" -f2- | rev )
echo " $tmpstpth is not present ,Creating it" #mkdir -p ${stpth}
printf "\n"
fi

printf "#################### Checked out stdenv in $stpth and .Sandbox.pset has


been Custumized Accordingly >> "
}
env (){
#echo "$tpth : $a : $b \n"
cline=$(cat -s $tpth | sed -n /Line/p | wc -l )
#echo "Count $cline"
if [[ ${a} = 'abinitioCoOp' ]];then
((ac++))
if [[ ${ac} = '2' ]];then
while [[ ${cline} -gt '0' ]];
do
exprt
((--cline))
done
fi
elif [[ ${a} = 'oraClient' ]];then
exprt
fi
}
create () {
touch ${Epath}/${Fenv}
chmod 777 ${Epath}/${Fenv}
(cat ${cpth}/${tmpf}) >> ${Epath}/${Fenv}
echo " ${Fenv} file is created in $Epath"

exprt() {
if [[ $(cat ${Epath}/${Fenv} | grep -w "Line1" | wc -l) = '1' ]] ; then
sed -i "s|\<Line1\>|$pth|" ${Epath}/${Fenv}
sed -i "s/\<Line2\>/Line1/" ${Epath}/${Fenv}
sed -i "s|\<Line1\>|$pth|" $(pwd)/.sandbox.pset
sed -i "s|\<Line2\>|Line1|" $(pwd)/.sandbox.pset

else
echo "########################Follwing Env Variable(s) of ${a} are needed for to be
customized ,Enter the LINE NUMBER and VARIABLE Value when
Prompted############################# :"
sed -n "/Line/p" ${Epath}/${Fenv}
printf "\n"
printf "#######################Enter the line number which you want to change >> "
read ln 2>'/dev/null'
printf "########################Enter the Env Variable Value for corresponding Line
>> "
read -r vl 2>'/dev/null'
sed -i "$ln s|Line$ln|"$vl"|" ${Epath}/${Fenv}
if [[ ${ln} = '10' ]] && [[ ${a} = 'abinitioCoOp' ]];then
stpth=$vl
vl=$(echo "$vl" | rev | cut -d "/" -f 2- | rev)
#echo "Line 10 check :$vlcheck:$stpth"
sed -i "s|Line$ln|"$vl"|" $(pwd)/.sandbox.pset
stenv

elif [[ ${ln} = '3' ]] && [[ ${a} = 'abinitioCoOp' ]];then


if [[ ${shnt} = '1' ]];then
sed -i "s|Line$ln|"$vl"|" $(pwd)/.sandbox.pset

echo "In shared.abinitio & apphubrc loop modifying line 3"

sed -i "s|apth|"$rcApth"|g" ${shpth}/shared.abinitiorc


sed -i "s|Line3|"$vl"|g" ${shpth}/shared.abinitiorc
sed -i "s|Line3|"$vl"|g" ${rcpth}/apphubrc
vL=$(echo ${vl} | rev | cut -d "/" -f1 | rev)
echo "vL for rc file $vL"
sed -i "s|envL3|${vL}|g" ${rcpth}/apphubrc
sed -i "s|apth|"$rcCpth"|g" ${rcpth}/apphubrc
sed -i "s|envL3|${vL}|g" ${shpth}/shared.abinitiorc
else
sed -i "s|Line$ln|"$vl"|" $(pwd)/.sandbox.pset

echo "In Apphubrc in exprt"


sed -i "s|Line3|"$vl"|g" ${rcpth}/apphubrc
vL=$(echo ${vl} | rev | cut -d "/" -f1 | rev)
echo "vL for rc file $vL"
sed -i "s|envL3|"$vL"|g" ${rcpth}/apphubrc
sed -i "s|apth|"$rcCpth"|g" ${rcpth}/apphubrc

fi

else
sed -i "s|Line$ln|"$vl"|" $(pwd)/.sandbox.pset
fi
fi
echo " "
}

install () {
ex=$(echo ${i[$t]} | rev|cut -d "/" -f1 |rev)
expath=$(echo ${i[$t]} | rev|cut -d "/" -f2- |rev)
echo " Exceutable name ${ex}; Executable path ${expath}"
echo " Installing ${a} software in ${pth}"
if [[ ${a} = 'MSTGenericClient' ]] || [[ ${a} = 'RSCD89_CTO' ]] || [[ ${a} =
'abinitioBRDServices' ]] ;then
#continue
#echo $?
break
else
cpth=$(pwd)
cd ${cpth}
tmpf=${(ls -tr | grep -i ${a})}
#echo ${tmpf}
file=$(echo ${tmpf} | rev | cut -d ":" -f1 | rev)
Fenv=$(echo ${file} | sed -e "s/temp/$v/g")
echo "Env file will be named as ${Fenv}"
#echo "flg: ${flg},Version:${v},Abinitio version:${AbV}"
if [[ ${flg} = '1' ]] && [[ ${v} = ${AbV} ]];then
Epath="${Abpth}"
exprt
continue
else
echo "**************************************************************
Do you need to create env file in /abinitio/tmp/envs,
Enter 0 for this set up
OR
Enter the path
*******************************" #path needs to be changed
read -r Epath 2>'/dev/null'
fi
if [[ ${Epath} = '0' ]];then
Epath="/abinitio/tmp/envs"
if [[ $(echo ${Fenv} | cut -d "-" -f1) = 'ste' ]] && [[ ${flg} = '0' ]];then
((flg++))
AbV=${v}
Abpth="${Epath}"
stAb=${Fenv}
fi
if [[ ${(find ${Epath}/${Fenv} | wc -l )} = '1' ]] 2>'/dev/null' ;then
continue
else
create
fi
else
if [[ ${(find ${Epath}/${Fenv} | wc -l)} = '1' ]] 2>'/dev/null';then
continue
else
create
fi
fi
exprt
fi
tpth=${Epath}/${Fenv}
env
}

echo "###########################################1: If you need to proceed with


complete installation e.g Oraclient,Java,MSTGeneric Client,CoOp & AppHub >> Enter 1
#####################################
############################################## 2: If you need to configure
CoOp/AppHub >> Enter
2##################################################################################
############"
printf "\t >> "
read in 2>'/dev/null'

case ${in} in
"1")
printf "##########Enter the number of Executable files(RPM) needed to be installed
on this server >> "
read num
sleep 3
clear

echo "########Enter the complete paths where ABINITIO/JDK/ORACLIENT/Generic


Client/BRD RPM are present,#################
E.G
Oraclient :- /net/stealth/export1/home1.localhost/sw/Linux/oraK1CL-L-12.2.0.1-
SOE.x86_64.rpm ,
CoOp :- /net/stealth/export1/home1.localhost/sw/Linux/abinitioCoOp-V3.2.6.15.Full-
Linux.x86_64_93107@[email protected] ,
AppHub :- /net/stealth/export1/home1.localhost/sw/Linux/abinitioCoOp-AppHub-
V3.2.6.15.Full-Linux.x86_64_97506@[email protected] ,
JDK :- /net/stealth/export1/home1.localhost/sw/Linux/jdk-1.8.0_171l64-
linux.x86_64.rpm ,
Generic Client :- /net/stealth/export1/home1.localhost/sw/Linux/MSTGenericClient-
1.0_A0_0.0-159223.i686_1.0_A0_0.0@[email protected]

***********************************************************************************
************************************** "
echo "##########As per Input $num binaries will be installed on the server "

#sleep 2
#clear
ch=0
x=0
ac=0
flg=0
while [[ "$x" -lt "$num" ]];
do
printf "Enter the Complete Path of exceutable >> "
read -r i[$x] 2>'/dev/null'
printf "\n"
a=$(echo ${i[$x]} | rev | cut -d "." -f1 | rev );if [[ ${a} = 'rpm' ]];then echo "
"; else echo "Path for ${i[$x]} is not ending with 'rpm' , Please enter the
Complete path" ; read -r i[$x] 2>'/dev/null';fi
#echo "###################################################"
#if [[ ${x} -ge 1 ]];then

#echo "########Press 1 if you have entered all the paths###################,


#else
##############Press 0 to continue#################"
#read ch
#if [[ ${ch} = 1 ]];then
#break
#else
#$((x++)) 2>'/dev/null'
#continue
#fi
#fi
$((x++)) 2>'/dev/null'
done
#echo "number of time loop worked $((x+1))"
IFS=$'\n' i=($(sort -r <<<"${i[*]}"))
unset IFS
t=0
clear
while [[ ( "$t" -lt ${num} ) ]];
do
a=$(echo ${i[$t]} |rev|cut -d "/" -f1 | rev | cut -d "-" -f1)
#echo "${a}"
if [[ ${a} = 'abinitioCoOp' ]];then
b=$(echo ${i[$t]} |rev| cut -d "/" -f1 | rev | cut -d "-" -f2)
if [[ ${b} = 'AppHub' ]];then
Apath=$(echo ${i[$t]} | rev |cut -d "/" -f1 | rev | cut -d "-" -f1,2,3 | cut -d "."
-f1-4 | cut --complement -c 9-12)
echo "Apphub path /optware/${Apath} is created"
pth=/optware/${Apath}
v=$(echo ${Apath} | cut -d "-" -f3)
rcApth=$pth
rcfile
else
Cpath=$(echo ${i[$t]} |rev|cut -d "/" -f1 |rev| cut -d "-" -f1,2 | cut -d "." -f1-4
| cut --complement -c 9-12)
echo "CoOp path /optware/${Cpath} is created"
pth="/optware/${Cpath}"
v=$(echo ${Cpath} | cut -d "-" -f2)
rcCpth=$pth
rcfile
fi
elif [[ ${a} = 'MSTGenericClient' ]] || [[ ${a} = 'RSCD89_CTO' ]] || [[ ${a} =
'abinitioBRDServices' ]] ;then
pth="/opt"
else
if [[ ${a} = 'oraK1CL' ]];then
a=oraClient
#echo " Created directory ${a} in path /optware"
Dpath=$(echo ${i[$t]} |rev|cut -d "/" -f1 | cut -d "-" -f2 | rev | cut -d "_" -f1)
echo " Created directory in path /optware/${a}/${Dpath}"
pth=/optware/${a}/${Dpath}
v=${Dpath}
else
#echo " Created directory ${a} in path /optware"
Dpath=$(echo ${i[$t]} |rev|cut -d "/" -f1 | cut -d "-" -f2 | rev | cut -d "_" -f1)
echo " Created directory in path /optware/${a}/${Dpath}"
pth=/optware/${a}/${Dpath}
v=${Dpath}
fi
fi
install

echo "***************************************************"
sleep 3
clear
$((t++)) 2>'/dev/null'
done
echo " Do you have want to set up Bias Keys also ? Enter y >> (Yes) or n >> (No) "
read bch
if [[ ${bch} = 'y' ]];then
echo "Loading env file .$Abpth/$stAb "
sleep 1
clear
echo " Giving read permission to Path /sys/devices/virtual/dmi/id/product_uuid� "
#chmod +r /sys/devices/virtual/dmi/id/product_uuid�
sleep 2
clear
printf "Enter Key File path >> "
read -r kypth
printf "\n"
echo "Adding key file to Abinitio Env"
sleep 2
clear
#ab-cinfo-util create -version 4�
#key file path i/p from user
#ab-key add <key file>
#test-abinitio
#ab-key show
fi
echo "********************Setup is Completed*********************"
;;

"2") (.${pwd}/test.ksh)
;;

*);;
esac

*****************************************888

export AB_HOME=/opt/abinitio2158
export AB_APPLICATION_HUB=/optware/abinitio-app-hub-3266
export AB_AIR_ROOT=//aisteemed/abinitio/eme/cits/ste-dev
export PATH=$AB_HOME/bin:/usr/sbin:$PATH
export LD_LIBRARY_PATH=${AB_HOME}/lib:${LD_LIBRARY_PATH}
export USER=${USER:-${LOGNAME:-$(basename $HOME)}}
export COMPREFIX=/abinitio/apps/
export STE_ENVIRONMENT_NAME=CitiTech

*********************************************

/net/stealth/export1/home1.localhost/sw/Linux/abinitioCoOp-V3.2.6.15.Full-
Linux.x86_64_93107@[email protected]
/net/stealth/export1/home1.localhost/sw/Linux/jdk-1.8.0_171l64-linux.x86_64.rpm
/net/stealth/export1/home1.localhost/sw/Linux/MSTGenericClient-1.0_A0_0.0-
159223.i686_1.0_A0_0.0@[email protected]
/net/stealth/export1/home1.localhost/sw/Linux/oraK1CL-L-12.2.0.1-SOE.x86_64.rpm
/net/stealth/export1/home1.localhost/sw/Linux/abinitioCoOp-AppHub-V3.2.6.15.Full-
Linux.x86_64_97506@[email protected]
export STE_COMPREFIX=/abinitio/apps/
export STE_ENV_ROOT=/abinitio/apps/ste-stable/CitiTech/stdenv

#####################################################

(cat $line1 | grep -i $val |cut -d "=" -f2| sed "s|[^ ]||g" | sed -e "s|^$|$res|")

You might also like