- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Script at boot up.
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
Forums
Discussions
Discussions
Discussions
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
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-25-2006 06:04 AM
06-25-2006 06:04 AM
I would like to execute them when the system comes up and shuts down. Tese are to bring the databeses and shut them down.
Can someone help me set them up.
Where would it be the best place to put them and how.
Thanks...
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2006 06:11 AM
06-25-2006 06:11 AM
SolutionStart-up and shutdown scripts are quite easy to implement. In fact, a template exists to expedite the process: '/sbin/init.d/template'.
I urge you to take the few minutes needed to read the whitepaper below. It applies to all HP-UX releases since 10.x.
http://www.docs.hp.com/en/934/startup.pdf
A summary of it's key points can also be found in the manpages for 'rc(1M)':
http://www.docs.hp.com/en/B2355-60127/rc.1M.html
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2006 06:16 AM
06-25-2006 06:16 AM
Re: Script at boot up.
The the best place to put your startup and shutdown scripts is /sbin/init.d
Here you have got a file called template which can be used as the template for the script which is used during system starup and shutdown. You can modify this template to put your commands for database startup and shutdown in the corresponding sections of start and stop.
Then create the soft links in /sbin/rc3.d as
ln -s /sbin/init.d/oracle Snnnoracle [ Decide this number nnn depending upon when the script should run - the number decides when that script will be run.(higher number scripts will run after the lower number script has been run.)
Also create a link in /sbin/rc2.d
ln -s /sbin/init.d/oracle Knnnoracle
There should be standard scripts available for startup and shutdown and am sure someone here might be able to provide you sample script as well.
Regards,
Ninad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2006 06:19 AM
06-25-2006 06:19 AM
Re: Script at boot up.
Next, look in /sbin/init.d for a file called 'template' and copy it to a new file (e.g. /sbin/init.d/dbscript). You will find 4 sections with a case statement: 1) start_msg, 2) start, 3) stop , and 4) stop_msg. Each of these is executed by the rc command when the machine is booted and shutdown. The start_msg and start sections are executed on startup and the stop_msg and stop sections are executed on shutdown. The xxx_msg sections simply echo to the console. The start section should call your "real" startup script and the stop section should call your "real" shutdown script.
So far, you have actually done nothing because those scripys in /sbin/init.d are not actually invoked by rc; you must now create symbolic links. You will probably want to start execution in run-level 3, so create a symbolic link in /sbin/rc3.d (e.g ln -s /sbin/init.d/dbscript /sbin/rc3.d/S750dbscript. The scripts under a giver rc.N directory are executed in lexical order so if your dbscripts requires that other services such as NFS be up first that you Snnn values occur after those that you need first. By convention, the shutdown scripts are executed at run-level - 1 from the start scripts and if you choose 3 digit numbers (zero-padded if necessary) that add
to 1000, the startup and shutdown scripts almost always occur in correct sequence.
Your symbolic link for the shutdown script should be something very close to this:
ln -s /sbin/init.d/dbscript /sbin/rc2.d/K250dbscript.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2006 06:23 AM
06-25-2006 06:23 AM
Re: Script at boot up.
If you have a valid "oratab" file and the ORACLE_HOME variable is defined and exported, then follow the steps below...
1. Install the script in the /sbin/init.d directory, name it oracle.
2. make symbolic links to the 2nd and 3rd run-levels for stopping and starting oracle respectively, like...
ln -s /sbin/init.d/oracle /sbin/rc3.d/S900oracle
ln -s /sbin/init.d/oracle /sbin/rc2.d/K100oracle
~hope it helps
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2006 07:31 AM
06-25-2006 07:31 AM
Re: Script at boot up.
In addition to above, please look at an example of simple oracle start/stop script. In order to use it, create /etc/rc.config.d/oraconf file, which may help you to switch on/off oracle startup.
Please take into account that the script works only when all your databases are built with the same ORACLE_HOME. Additionally pay your attention that listener is started up in its simplest form.
You may need to update the script according to existing conditions.
Also look at $ORACLE_HOME/bin/dbshut script and add parameter IMMEDIATE or TRANSACTIONAL for each shutdown command in it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2006 02:18 PM
06-26-2006 02:18 PM
Re: Script at boot up.
How would I get this script to start up when the system boots up ? if it can be done.
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2006 03:20 PM
06-26-2006 03:20 PM
Re: Script at boot up.
>>How would I get this script to start up when the system boots up ? if it can be done.
Assuming the script your DBA has created is called "start_stop_oracle". Copy this script to "/sbin/init.d" directory. Now create symbolic links to this script in the 2nd and 3rd run levels for stopping and starting it as follows:
# ln -s /sbin/init.d/start_stop_oracle /sbin/rc2.d/S900start_stop_oracle
# ln -s /sbin/init.d/start_stop_oracle /sbin/rc2.d/K100start_stop_oracle
That's all you have to do for the "script to start up when the system boots up".
~cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2006 03:37 PM
06-26-2006 03:37 PM
Re: Script at boot up.
I have done this but no luck...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2006 03:39 PM
06-26-2006 03:39 PM
Re: Script at boot up.
e.g.
. /usr/local/bin/oraenv.sh
(oraenv.sh must not contain a return or exit statement because this sourced file is actually a part of the foreground process.
That will safely source the file and now you
do not use the "-" in the su command so that .profile is not used.
Method B is to continue to use "-" and alter .profile so that those tty related commands are ignored:
if [ -t 0 ]
then #stdin is a tty device
tput ...
tset ...
stty ...
tabs
fi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2006 04:36 PM
06-26-2006 04:36 PM
Re: Script at boot up.
Awadhesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2006 10:06 AM
06-27-2006 10:06 AM
Re: Script at boot up.
miaux10: / =>ln -s /sbin/init.d/oracle_ctl.sh /sbin/rc3.d/S900su - oracle -c '/sbin/init.d/orcale_ctl.sh start'
Usage: ln [-f] [-i] [-s] f1 f2
ln [-f] [-i] [-s] f1 ... fn d1
Please help..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2006 10:14 AM
06-27-2006 10:14 AM
Re: Script at boot up.
ln -s /sbin/init.d/oracle_ctl.sh /sbin/rc3.d/S900su - oracle -c '/sbin/init.d/orcale_ctl.sh start'
Does oracle_ctl.sh even understand the start|stop|start_msg|stop_msg arguments?
If not, you start with a copy of the template file and within the start) section of you you do your "su - oracle -c oracle_ctl.sh". Your symbolic links link thios template file copy to entries in the rc.N directories. The ln -s command will not pass command line arguments. Man ln would probably help.
I patiently explained all this above and you chose to ignore it. Also, you would be wise to heed my warning about "su - oracle" rather than "su oracle".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2006 10:17 AM
06-27-2006 10:17 AM
Re: Script at boot up.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2006 10:27 AM
06-27-2006 10:27 AM
Re: Script at boot up.
You need to symbolic link like this:
# ln -s /sbin/init.d/s_k_oracle /sbin/rc3.d/S900s_k_oracle
NOTE that the basename ("s_k_oracle") is used both in the basename of the '/sbin/init.d' directory and the '/sbin/rc2.d' directory. Do the same kind of thing for the 'kill' script:
# ln -s /sbin/init.d/s_k_oracle /sbin/rc2.d/K100s_k_oracle
...but use "K" instead of "S" and follow the "rule-of-1000".
Now, *inside* the '/sbin/init.d/s_k_oracle script you should place the command to switch to the oracle user:
# su oracle -c ' ... ' #...fill in appropriately.
*Now* test by doing:
# /sbin/init.d/s_k_oracle start
# /sbin/init.d/s_k_oracle stop
If you have used the '/sbin/init.d/template' as a guide, this should work quite well.
Look at the whitepaper I originally suggested, again, along with the 'rc(1M)' manpages and a simple startup script like:
# /sbin/init.d/cron
Regards!
...JRF...