Operating System - HP-UX
1834395 Members
1555 Online
110066 Solutions
New Discussion

Re: database startup automatically upon server restart in /etc/inittab

 
SOLVED
Go to solution
apple
Super Advisor

database startup automatically upon server restart in /etc/inittab

dear HPUX guru,
would like to seek your advice. can i call a script inside inittab to start one of our database.
the full path of the script is:
/disc01/script/monitor.sh
hope to hear from you. thanks a loy

27 REPLIES 27
Jeeshan
Honored Contributor

Re: database startup automatically upon server restart in /etc/inittab

Hi

Like a similar thread!!! click this

http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=1213678
a warrior never quits
Jeeshan
Honored Contributor

Re: database startup automatically upon server restart in /etc/inittab

Yogeeraj_1
Honored Contributor

Re: database startup automatically upon server restart in /etc/inittab

hi,

It is better to follow the standard way as recommended by HP.

The generic instructions are found in the document found at URL below:
http://docs.hp.com/en/934/startup.pdf

You can configure your oracle database to start using the same principles.

if you need any further assistance, please let us know.

kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Yogeeraj_1
Honored Contributor

Re: database startup automatically upon server restart in /etc/inittab

hi again,

also refer to scripts and additional instructions found at:
http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=1218941


hope this helps too!
kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
apple
Super Advisor

Re: database startup automatically upon server restart in /etc/inittab

thank you for the very useful link, but i think the script is called from oratab. appreciate you can help me with database script call from /etc/inittab. i've put this entry inside inittab.
db2inst1:3456:wait:/db2/script/monitor_db2.shappreciate your advice what this 3456 represents?
i check the man, what is the best wait, respawn or once?
promis of good points, hope to hear from you. thanks a lot.
Dennis Handly
Acclaimed Contributor
Solution

Re: database startup automatically upon server restart in /etc/inittab

>appreciate you can help me with database script call from /etc/inittab.

The recommendation by Yogeeraj, Ahsan and others is to NOT do this. Use the rc(2) method.
It seems all inittab buys you is that if it aborts it will restart. But something will be seriously wrong if that happens.
Yogeeraj_1
Honored Contributor

Re: database startup automatically upon server restart in /etc/inittab

hi,


>... but i think the script is called from oratab.
/etc/oratab is just a reference file. If you read the comments in the header of the file, you will understand it properly.

> db2inst1:3456:wait:/db2/script/monitor_db2.shappreciate your advice what this 3456 represents?

If you run 'man inittab', you would get the following info.

The inittab file is composed of entries that are position-dependent and have the following format:
id:rstate:action:process

So 3456 is the rstate value.

"rstate" defines the run level in which this entry is to be processed. Run levels correspond to a configuration of processes in the system where each process spawned by
boot init is assigned one or more run levels in which it is allowed to exist. Run levels are represented by a number in the range 0 through 6.

So your script is configured to run at either of runlevels 3,4,5 and 6.



> I check the man, what is the best wait, respawn or once?
it will definitely depend on the login that you are trying to implement.

AS you have already seen in the man pages.
"once" is

when boot init enters a run level that matches the entry's rstate,start the process and do not wait for its termination. When it dies, do not restart the process. If boot init enters a new run level but the process is still running from a previous run level change, the process is not restarted.



Hope this helps!

kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
apple
Super Advisor

Re: database startup automatically upon server restart in /etc/inittab

i've put this entry inside my /etc/inittab, but when the server restart the it didn't run the script:
sybaseiq:3456:wait:/INSIDES_01/script/monitor_sybaseiq.sh

is it because of the system state is wait? i see respawn and once, i feel wait is ok. please let me know if it is not sufficient.

thanks a lot. hope to hear from you. promise of good points.
Yogeeraj_1
Honored Contributor

Re: database startup automatically upon server restart in /etc/inittab

hi,

as mentioned earlier, this is a very unconventional way of starting your application processes at least on hp-ux.


please try the example as provided in my post found at: http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=1218941


if you need any further assistance, do let us know.

kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Jeeshan
Honored Contributor

Re: database startup automatically upon server restart in /etc/inittab

Hi

>>i've put this entry inside my /etc/inittab, but when the server restart the it didn't run the script:
sybaseiq:3456:wait:/INSIDES_01/script/monitor_sybaseiq.sh

It's better to put it in rc* directory rather than /etc/inittab file. it's been sometimes dangerous to put files there.
a warrior never quits
apple
Super Advisor

Re: database startup automatically upon server restart in /etc/inittab

when i issue, ls -la |grep rc inside /etc directory, these are all the rc files that i can find:
/etc>ls -la |grep rc
-r--r--r-- 1 bin bin 635 Mar 26 2004 rc.config
drwxr-xr-x 2 bin bin 8192 Apr 5 12:38 rc.config.d
-rw-r--r-- 1 root root 122691 Apr 28 17:38 rc.log
-rw-r--r-- 1 root root 140181 Apr 28 17:37 rc.log.old

after that, i go to rc.config.d, i can see all the files inside as attached.
would really appreciate your close guide. where to edit the file. hope to hear from you.
Jeeshan
Honored Contributor

Re: database startup automatically upon server restart in /etc/inittab

rc files are all resides in /sbin directory
see the structure of ding so that you can easily understand how can you do that.
a warrior never quits
apple
Super Advisor

Re: database startup automatically upon server restart in /etc/inittab

attached are all the rc files under /sbin. what can i do with this file. hope to hear from you. thanks a lot.
Jeeshan
Honored Contributor

Re: database startup automatically upon server restart in /etc/inittab


#cd /sbin/rc3.d

#touch Soraclsstart

#ln -s /disc01/script/monitor.sh Soraclsstart

#chmod 755 Soraclsstart
example:

#touch S1000oraclsstart

#ln -s /disc01/script/monitor.sh S1000oraclsstart

#chmod S1000oraclsstart

create like this in test environment then deploy to production.
a warrior never quits
apple
Super Advisor

Re: database startup automatically upon server restart in /etc/inittab

very great. below are some of queries, appreciate you can shed some lights.
#cd /sbin/rc3.d
almond > ok, have found the directory
#touch Soraclsstart
almond > our database is sybase, 1. where can i find the sequence id, 2. oraclestart is this system definable or we can name any name

ok, will deploy on test / development server first. to test this, we need to restart the server right.

hope to hear from you. thanks a lot

Jeeshan
Honored Contributor

Re: database startup automatically upon server restart in /etc/inittab


>>almond > our database is sybase, 1. where can i find the sequence id, 2. oraclestart is this system definable or we can name any name


1. the sequence number you can take which are not stated in /sbin/rc*.d directories.

2. you can give it any name. But this must be linked to your script.
a warrior never quits
Yogeeraj_1
Honored Contributor

Re: database startup automatically upon server restart in /etc/inittab

hi,

concerning the naming of the files, you can use any convention as long as you stick to it. The lower the sequence number, the high the priority when it comes to running of the script at that particular runlevel.

You can use the following: (examples)


rc2.d/S900oracle
rc2.d/S901sybase

then

rc1.d/K101oracle
rc1.d/K100sybase


hope this helps!
kind regards
yogeeraj


No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Yogeeraj_1
Honored Contributor

Re: database startup automatically upon server restart in /etc/inittab

hi again,

>ok, will deploy on test / development server first. to test this, we need to restart the server right.


Yes. it is perferrable to experiment this in your test server first. You can make the scripts run only when the operating system switches runlevels, either up or down.

Shutdown and startups are more easy way to perform your tests.

You will find the startup/shutdown messages particular to these scripts in the /etc/rc.log file.

hope this helps too!
kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Dennis Handly
Acclaimed Contributor

Re: database startup automatically upon server restart in /etc/inittab

>when i issue, ls -la |grep rc inside /etc directory,

Read rc(1M):
http://docs.hp.com/en/B2355-60130/rc.1M.html

The directory is: /sbin/init.d/
Then you symlink to the correct run level directory: /sbin/rc3.d/S###name

>ahsan:
#cd /sbin/rc3.d
#touch Soraclsstart

You should put the real file in /sbin/init.d/ and only symlink to rc3.d/.

You typically use the same script to start and stop and you would have two symlinks.
Yogeeraj_1
Honored Contributor

Re: database startup automatically upon server restart in /etc/inittab

hi again,

as mentioned by Dennis above,

an example would be:

You can use the following: (examples)


rc2.d/S900oracle --> /sbin/init.d/oracle
rc2.d/S901sybase --> /sbin/init.d/sybase

then

rc1.d/K101oracle --> /sbin/init.d/oracle
rc1.d/K100sybase --> /sbin/init.d/sybase

Of course, the contents of these scripts should be as per conventions (see the URL mentioned by Dennis above) and also the /etc/rc.config.d/oracle and /etc/rc.config.d/sybase containing the appropriate flags to control the startup/shutdown.


hope this helps too!
kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
apple
Super Advisor

Re: database startup automatically upon server restart in /etc/inittab

come back very late. do i need to chmod of the file? hope to hear from you
#pwd
/sbin/rc3.d
#ls -lrt
lrwx------ 1 root sys 32 May 7 17:42 S901monitor_sybaseiq.sh -> /sbin/init.d/monitor_sybaseiq.sh

the database script is:
#pwd
/sbin/init.d
#ls -lrt
-rwxr-xr-x 1 root sys 289 May 7 17:41 monitor_sybaseiq.sh
Jeeshan
Honored Contributor

Re: database startup automatically upon server restart in /etc/inittab

after long time hear from u.

yes, the permission should be 755.


Don't forget to fillup the unassigned points area. :)
a warrior never quits
apple
Super Advisor

Re: database startup automatically upon server restart in /etc/inittab

do i need to change for both files or only the symbolic file? how about the owner of the file?
hope to hear from you. thank you
Jeeshan
Honored Contributor

Re: database startup automatically upon server restart in /etc/inittab

this should be root:sys
a warrior never quits