-
Notifications
You must be signed in to change notification settings - Fork 0
/
Master.sh
65 lines (45 loc) · 2.36 KB
/
Master.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash
source /Sqoop/Parameters.cfg
Source_name=`echo "$1"|tr [[:lower:]] [[:upper:]]`
env_name=`echo "$2"|tr [[:lower:]] [[:upper:]]`
if [ $# != 2 ]
then
echo "Please enter Source name and env "
###############FOR SRC_table###########################################
elif [[ $# == 2 && $Source_name == "SRC_table" && $env_name == "DEV" ]]
then
########################## Dev Env ############################
user_name=`cat $PassWord | grep -e "$Source_name|$env_name" | cut -d'|' -f 3`
user_ps=`cat $PassWord | grep -e "$Source_name|$env_name" | cut -d'|' -f 4`
host_name=Dbswd0016
source_file=""
elif [[ $# == 2 && $Source_name == "SRC" && $env_name == "TST" ]]
then
echo "OK"
############################# Test Env ##########################
user_name=`cat $PassWord | grep -e "$Source_name""|""$env_name" | cut -d'|' -f 3`
user_ps=`cat $PassWord | grep -e "$Source_name|$env_name" | cut -d'|' -f 4`
host_name="jdbc:sqlserver://localhost:databaseName=test_mynewdb"
source_file=/home/mahitha/SRC_table_Scripts/Parameters.cfg
#echo $source_file $host_name $user_name $user_ps
sh $Script_Location/wrapper_script.sh $source_file $host_name $user_name $user_ps
elif [[ $# == 2 && $Source_name == "SRC" && $env_name == "STG1" ]]
then
######################################### Stg ENV ############################
user_name=`cat $PassWord | grep -e "$Source_name|$env_name" | cut -d'|' -f 3`
user_ps=`cat $PassWord | grep -e "$Source_name|$env_name" | cut -d'|' -f 4`
host_name=""jdbc:sqlserver://localhost;databaseName=stg_mynewdb""
source_file=$Script_Location/Parameters.cfg
sh $Script_Location/wrapper_script.sh $source_file $host_name $user_name $user_ps
elif [[ $# == 2 && $Source_name == "SRC" && $env_name == "PRD" ]]
then
####################################### PRD ENV ##############################
user_name=`cat $PassWord | grep -e "$Source_name|$env_name" | cut -d'|' -f 3`
user_ps=`cat $PassWord | grep -e "$Source_name|$env_name" | cut -d'|' -f 4`
host_name=""jdbc:sqlserver://localhost:databaseName=prd_mynewdb""
source_file=$Script_Location/Parameters.cfg
sh $Script_Location/wrapper_script.sh $source_file $host_name $user_name $user_ps
echo "PRD"
else
echo "entered arguments are invalid "
fi