Hermes_Setup.ctl
Reporistory:Hermes_CB
Technology:MSBI(SSIS-SSRS),Database
crt_Stru
#!/bin/bash
source config.setup
log_file=
if test "$#" -ne 1; then
ecrit
"Illegal number of parameters" | tee -a $log_File
else
ecrit
"Parameters are good to start"| tee -a $log_File
fi
source_file=$1
master_folder=`grep 'Reporistory' $source_file | cut -d ':'
-f2`
tech_folder=`grep 'Technology' $source_file | cut -d ':'
-f2`
me=`basename "$0"`
log_File=${master_folder}_${me}_$(date
+"%m-%d-%Y")
rm -f ${master_folder}_${me}_*
echo $rep_dir
echo $master_folder
ecrit 'Techincal folders are '$tech_folder ' script '$me |
tee -a $log_File
c_master=${rep_dir}${master_folder}
ecrit '***** step 01 Create Master Folder name started *****
'
ecrit ''
ecrit ' folder to create '$c_master | tee -a $log_File
if [[ -z
"$master_folder" ]]; then
ecrit 'Master Folder value is empty'| tee -a $log_File
exit 4
else
if [ ! -d "$c_master" ]; then
mkdir $c_master
else
ecrit 'Master Folder name already exits' | tee -a $log_File
#exit 5
fi
fi
rm $script_path/${master_folder}_tmp
echo $script_path/${master_folder}_tmp
ecrit '***** step 01 Create Master Folder name Completed'
ecrit '***** step 00 Create Repository in server started
***** '
ecrit ''
#crete repository code
#
#
#
ecrit '***** step 00 Create Repository in server Completed'
cat_file=$script_path$catelog_file
OIFS=$IFS;
IFS=",";
techArray=($tech_folder);
ecrit 'Total folder '$tech_folder
for ((i=0; i<${#techArray[@]}; ++i));
do
ecrit
"Folder name is $i: ${techArray[$i]}" | tee -a $log_File
done
ecrit '***** step *********'
for ((i=0; i<${#techArray[@]}; ++i));
do
ecrit
"Folder name from main loop $i: ${techArray[$i]}" | tee -a $log_File
val=`echo
${techArray[$i]} | cut -d '(' -f1`
Parent_folder=`grep
$val $cat_file | cut -d ':' -f1`
ecrit 'parent
folder is '$Parent_folder
if [[
-z "$Parent_folder" ]]; then
ecrit
'Mentioned Folder name is not available in catelog file.. please check the
given name' | tee -a $log_File
exit 6
fi
if [ !
-d "$c_master/$Parent_folder" ]; then
mkdir
$c_master/$Parent_folder
fi
folder=`grep
$Parent_folder $cat_file | cut -d ':' -f2`
echo
$folder > $script_path/${master_folder}_tmp
eliminate=`echo
${techArray[$i]} | awk -F '[(|)]' '{print $2}' | sed 's/-/,/g'`
ecrit
'Folder to be removed '$eliminate
if [[
-z "$eliminate" ]]; then
ecrit
'No custom folder to create' |
tee -a $log_File
techsubArray=($folder);
else
eliminate_array=($eliminate);
for
((k=0; k<${#eliminate_array[@]}; ++k));
do
ecrit
'the eliminate items '${eliminate_array[$k]}
sed
-i "s/${eliminate_array[$k]}//g" $script_path/${master_folder}_tmp
sed
-i -e 's/^ *//' -e 's/ //' -e 's/
/,/g' $script_path/${master_folder}_tmp
done
folder_v=`cat
$script_path/${master_folder}_tmp`
ecrit
'final value to create '$folder_v
techsubArray=($folder_v);
fi
for
((j=0; j<${#techsubArray[@]}; ++j));
do
ecrit
"sub folder name sub loop $j:
${techsubArray[$j]}" | tee -a
$log_File
if
[ ! -d "$c_master/$Parent_folder/${techsubArray[$j]}" ]; then
mkdir
$c_master/$Parent_folder/${techsubArray[$j]}
ecrit
'sub value' $c_master/$Parent_folder/${techsubArray[$j]}
else
ecrit
'Folder name already exits'
#exit
5
fi
done
#echo "Folder name
$i: ${techArray[$i]}";
done
IFS=$OIFS;
ecrit 'Clearing tmp files'
rm $script_path/${master_folder}_tmp
config.setup
#!/bin/bash
rep_dir=/home/senthil/
script_path=/home/senthil/senthil_work
host_name=
catelog_file=$log_dir/catalog.fl
ecrit() {
date +"%H:%M
$(printf " %s " " $@" | sed 's/%/%%/g')"
catalog.fl
technology:Tools
Informatica:Mappings,Workflow,worklet,scripts,DB_objects,Autosys_script
MSBI:SSIS,SSAS,SSRS,powershell,scripts
BO:Universe,crystal_reports
Database:Procedure,function,views
launch_sh
#!/bin/bash
if test "$#" -ne 2; then
echo "Illegal
number of parameters"
exit 1
else
echo "Parameters
are good"
fi
source config.setup
proj_setup=$2
script_name=$1
if [ -f ${proj_setup} ]
then
ecrit
"$proj_setup Project set up file is found...."
else
ecrit
"$proj_setup Project set up file is not found...."
exit 2
fi
if [ -f ${script_name} ]
then
ecrit
"$script_name Script file is found...."
else
ecrit
"$script_name Script file is not found...."
exit 3
fi
rep_dir=/home/senthil/
host_name=
catelog_file=$log_dir/catalog.fl
ecrit "Calling the Main Script to execute......"
./$1 $2
No comments:
Post a Comment