-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathrunTimeOracleOnReboot.sh
executable file
·98 lines (87 loc) · 3.35 KB
/
runTimeOracleOnReboot.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
#!/bin/sh
#
# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#################################################################################
#
# File: runTimeOracleOnReboot.sh renamed as oracle in final VM
#
# Description: init.d file to startup oracle and ords on reboot.
#
#################################################################################
#
# chkconfig: 2345 99 99
#
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/version/db_1
export ORACLE_HOME_LISTENER=$ORACLE_HOME
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
#export JAVA_HOME=$ORACLE_HOME/jdk
export PATH=$PATH:$ORACLE_HOME/bin:$JAVA_HOME/bin
export ORACLE_SID=orclcdb
#export ORACLE_TRACE=Y
export PATH=$JAVA_HOME/bin:$ORACLE_HOME/bin:$PATH
# Source function library.
. /etc/rc.d/init.d/functions
# See how we were called.
case "$1" in
start)
echo "1" > /proc/sys/net/ipv4/ip_forward
# Route 80 -> 8888 for XDB
iptables -t nat -A PREROUTING -m tcp -p tcp --dport 80 -j REDIRECT --to-port 8888
iptables -t nat -A PREROUTING -m tcp -p tcp --dport 21 -j REDIRECT --to-port 2121
su oracle -c "$ORACLE_HOME/bin/lsnrctl start"
su oracle -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME"
su oracle -c "echo alter pluggable database all open';'|$ORACLE_HOME/bin/sqlplus / as sysdba"
if test -f /home/oracle/bin/ords.sh
then
su oracle -c "/home/oracle/bin/ords.sh start /home/oracle/ords/ords.war"
nohup su - oracle -c "/home/oracle/bin/9090start >> /tmp/9090startlog 2>&1" &
fi
;;
stop)
if test -f /home/oracle/bin/ords.sh
then
su oracle -c "/home/oracle/bin/ords.sh stop /home/oracle/ords/ords.war"
nohup su - oracle -c "/home/oracle/bin/9090stop >> /tmp/9090stoplog 2>&1" &
fi
su oracle -c "$ORACLE_HOME/bin/dbshut $ORACLE_HOME"
su oracle -c "$ORACLE_HOME/bin/lsnrctl stop"
;;
restart|reload)
if test -f /home/oracle/bin/ords.sh
then
su oracle -c "/home/oracle/bin/ords.sh stop /home/oracle/ords/ords.war"
nohup su - oracle -c "/home/oracle/bin/9090stop >> /tmp/9090stoplog 2>&1" &
fi
su oracle -c "$ORACLE_HOME/bin/dbshut $ORACLE_HOME"
su oracle -c "$ORACLE_HOME/bin/lsnrctl stop"
su oracle -c "$ORACLE_HOME/bin/lsnrctl start"
su oracle -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME"
su oracle -c "echo alter pluggable database all open';'|$ORACLE_HOME/bin/sqlplus / as sysdba"
if test -f /home/oracle/bin/ords.sh
then
su oracle -c "/home/oracle/bin/ords.sh start /home/oracle/ords/ords.war"
nohup su - oracle -c "/home/oracle/bin/9090start >> /tmp/9090startlog 2>&1" &
fi
;;
status)
$ORACLE_HOME/bin/lsnrctl status
;;
*)
echo $"Usage: $0 {start|stop|restart|reload}"
exit 1
esac
exit 0