- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Putting the Oracle Listener in a rc3.d script
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-29-2007 06:04 AM
тАО06-29-2007 06:04 AM
I am trying to automate the start of the ORacle 10g listener in a script at run level 3. The stop script works just fine but the start does not seem to execute properly.
Any ideas folks?
Here is the entire script:
PATH=/usr/sbin:/usr/bin:/sbin
export PATH
# NOTE: If your script executes in run state 0 or state 1, then /usr might
# not be available. Do not attempt to access commands or files in
# /usr unless your script executes in run state 2 or greater. Other
# file systems typically not mounted until run state 2 include /var
# and /opt.
rval=0
# Check the exit value of a command run by this script. If non-zero, the
# exit code is echoed to the log file and the return value of this script
# is set to indicate failure.
set_return() {
x=$?
if [ $x -ne 0 ]; then
echo "EXIT CODE: $x"
rval=1 # script FAILed
fi
}
case $1 in
'start_msg')
# Emit a _short_ message relating to running this script with
# the "start" argument; this message appears as part of the checklist.
echo "Starting the Oracle 10g Agent - no start executed"
;;
'stop_msg')
# Emit a _short_ message relating to running this script with
# the "stop" argument; this message appears as part of the checklist.
echo "Stopping the Oracle 10g Agent - no stop executed"
;;
'start')
# Execute the commands to start your subsystem
su oracle -c "/u01/app/oracle/product/10.2.0/agent10g/bin/emctl start agent" > orastart.txt
set_return
;;
'stop')
# Execute the commands to stop your subsystem
su oracle -c "/u01/app/oracle/product/10.2.0/agent10g/bin/emctl stop agent" > orastop.txt
set_return
;;
*)
echo "usage: $0 {start|stop|start_msg|stop_msg}"
rval=1
;;
esac
exit $rval
Robert
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-29-2007 06:36 AM
тАО06-29-2007 06:36 AM
Re: Putting the Oracle Listener in a rc3.d script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-29-2007 06:39 AM
тАО06-29-2007 06:39 AM
Re: Putting the Oracle Listener in a rc3.d script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-29-2007 06:47 AM
тАО06-29-2007 06:47 AM
Re: Putting the Oracle Listener in a rc3.d script
su oracle -c "export ORACLE_HOME=/u01/app/oracle/product/10.2.0/agent10g;emctl start agent"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-29-2007 07:01 AM
тАО06-29-2007 07:01 AM
Solution/usr/local/bin/myorastart.sh
-------------------------------------
#!/usr/bin/sh
typeset -i STAT=0
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=${ORACLE_BASE}/product/10.x.y
ORACLE_SID=mickey
TNS_ADMIN=${ORACLE_HOME}/network/admin
PATH=${PATH}:${ORACLE_HOME}/bin
export ORACLE_BASE ORACLE_HOME ORACLE_SID TNS_ADMIN PATH
emctl start agent
STAT=${?}
exit ${STAT}
--------------------------------------------
The start) section of your rc'ed command does the "su oracle -c /usr/local/bin/myorastart.sh".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-29-2007 07:14 AM
тАО06-29-2007 07:14 AM
Re: Putting the Oracle Listener in a rc3.d script
Rob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-29-2007 07:25 AM
тАО06-29-2007 07:25 AM
Re: Putting the Oracle Listener in a rc3.d script
if [[ -t 0 ]]
then
stty ...
tabs ...
fi
but the better way is to create a file something like /usr/local/bin/oraenv.sh which sets and exports the variables and then both oracle's .profile and your rc'ed script source this file (via the . (dot) operator). The sourced file must not contain a return or exit statement because that would have the effect of exiting the foreground process since a sourced file does not create a child process.
This means that the above script would be changed to:
#!/usr/bin/sh
typeset -i STAT=0
.
emctl start agent
STAT=${?}
exit ${STAT}