-
Notifications
You must be signed in to change notification settings - Fork 2
/
runscript.sh
executable file
·113 lines (102 loc) · 2.69 KB
/
runscript.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#!/bin/bash
# Author: Christian Boerner, mailto: loci [at] locimotive.de
# NWL-Licence... do whatever you want with it. ;-)
DOMAIN_HOME="/u01/app/oracle/middleware12c/user_projects/domains/NEMIS_SC"
SCRIPT_HOME="/home/weblogic/bin/wlst"
SCRIPT_NAME=""
SETDOMAIN_OPTIONS=""
usage () {
echo -e "Usage: $0 [-w <directory>] [-d <directory>] -s <file> -p <properties>"
echo
echo -e "\t-w\tDefine your WL_HOME (the directory of your domain)"
echo -e "\t-d\tDefine your SCRIPT_HOME (the directory where your scripts are located)"
echo -e "\t-s\tThe script you want to run via WLST"
echo -e "\t-p\tProperties file passed to WLST script"
echo
echo -e "Current defaults:"
echo -e "\tWebLogic domain = $DOMAIN_HOME"
echo -e "\tScript directory = $SCRIPT_HOME"
exit 0;
}
while getopts ":hw:s:d:p:" opt; do
case $opt in
h) usage
exit 1
;;
w)
if [[ "$OPTARG" == "" ]]; then
echo "Option -$opt requires an argument" >&2
exit 1;
fi
DOMAIN_HOME="$OPTARG"
;;
s)
if [[ "$OPTARG" == "" ]]; then
echo "Option -$opt requires an argument" >&2
exit 1;
fi
SCRIPT_NAME="$OPTARG"
;;
d)
if [[ "$OPTARG" == "" ]]; then
echo "Option -$opt requires an argument" >&2
exit 1;
fi
SCRIPT_HOME="$OPTARG"
;;
p)
if [[ "$OPTARG" == "" ]]; then
echo "Option -$opt requires an argument" >&2
exit 1;
fi
SCRIPT_PROPS="$OPTARG"
;;
*)
echo "Invalid option. Try \"-h\" for help" >&2
exit 1
;;
esac
done
if [[ "${DOMAIN_HOME}" == "" ]]; then
echo "Error: DOMAIN_HOME is not set!" >&2
exit 1;
else
if [[ ! -d ${DOMAIN_HOME} ]]; then
echo "Error: ${DOMAIN_HOME} does not exist or is not readable" >&2
exit 1;
fi
fi
if [[ "${SCRIPT_HOME}" == "" ]]; then
echo "Error: SCRIPT_HOME is not set!" >&2
exit 1;
else
if [[ ! -d ${DOMAIN_HOME} ]]; then
echo "Error: ${SCRIPT_HOME} does not exist or is not readable" >&2
exit 1;
fi
fi
if [[ "${SCRIPT_NAME}" == "" ]]; then
echo "Error: SCRIPT_NAME is not set!" >&2
exit 1;
else
if [[ ! -r ${SCRIPT_HOME}/${SCRIPT_NAME} ]]; then
echo "Error: ${SCRIPT_HOME}/${SCRIPT_NAME} does not exist or is not readable"
exit 1;
fi
fi
if [[ "${SCRIPT_PROPS}" == "" ]]; then
echo "Error: SCRIPT_PROPS is not set!" >&2
exit 1;
fi
# ************* Setting the Environment ***********************
. ${DOMAIN_HOME}/bin/setDomainEnv.sh ${SET_DOMAIN_OPTIONS}
if [ $0 -eq 0 ]; then
echo "Environment has been set....."
else
echo "Error setting environment"
fi
# ************* Changing the directory where all the related files are needed ***********************
cd ${SCRIPT_HOME}
# ************* Calling the WLST script *****************
echo "Calling the PYTHON script....."
java weblogic.WLST ${SCRIPT_NAME} ${SCRIPT_PROPS}