General discussion

Locked

Starting and Stopping Things

By cp409sd ·
I have written a script, /etc/rc.d/init.d/oradb, which will startup or shutdown my oracle database depending on which parameter I give it.(eg. 'oradb start' or 'oradb stop') These commands work. I also created a symbolic link to this file and it is: /etc/rc.d/rc3.d/S98oradb This works for starting my database. My problem is shutting down the database. I tried to do the same thing,(creating the file: /etc/rc.d/rc6.d/K60oradb and symbolicly linking it to /etc/rc.d/init.d/oradb) but it does not seem to do anything. I had thought that by doing this, anytime the system entered run level 6, or a reboot, that this would get executed much the same way my startup script does.

I know the actual script to start and stop the database works, because I can execute it and give it start and stop parameters, and it will start and stop the database. Both symbolic links to the file seem fine also, as I can execute 'S98oradb start' and 'K60oradb stop' and they work just fine.

I am not sure why, but it seems like it is not even executing the file /etc/rc.d/rc6.d.

Any help would be appriciated.

This conversation is currently closed to new comments.

10 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Starting and Stopping Things

from what i understand and have tryed it out, you should put it in the same rc3.d dir, both S98oradb and K98oradb should be en /etc/rc.d/init.d/rc3.d and both linked to ../oradb.

start & kill services should be in the same run level

Collapse -

Starting and Stopping Things

by cp409sd In reply to Starting and Stopping Thi ...

I tried putting the start and stop symbolic links in the same run level,(both S98oradb and K98oradb) but it did not seem to have any effect.

Collapse -

Starting and Stopping Things

Hi!

The S and K scripts for one service should not both be in same runlevel dir.

Only way to securely take a unix server down is by first changing the run level to 6 or 0.

In linux you can do this by as root doing a: telinit 6
or
telinit 0

Where 6 is reboot and 0 is halt.
The halt respectiv reboot programs should call theese commands themselves, but I also noticed that it isn't really working that way.

And in Solaris manuals I read that reboot and halt command does not run theinit script and same might be true in Linux.

/Hasse

Collapse -

Starting and Stopping Things

by cp409sd In reply to Starting and Stopping Thi ...

When I issue a 'shutdown -r now' command, doesn't this execute all the scripts in the ../rc6.d directory? That was my understanding.

Collapse -

Starting and Stopping Things

by ddiall In reply to Starting and Stopping Thi ...

If, as you stated in the last sentence, it seems that nothing in /etc/rc.d/rc6.d is executing, you might have modified the /etc/inittab file or somehow fiddled with the /etc/rc.d/rc script.

In any case try to run '/etc/rc.d/rc 6' and see what happens. It should execute the start and stop scripts for runlevel 6.

Collapse -

Starting and Stopping Things

by cp409sd In reply to Starting and Stopping Thi ...

It seems that everthing else is executing correctly, except my script. All it has to do is accept the 'stop' parameter right? When I execute the script manually with the stop parameter, it works fine. It is linked correctly. I did not mess with my /etc/inittab or /etc/rc.d/rc, and they both look fine. I am out of ideas on what the problem could be. Any other ideas? Thanks.

Collapse -

Starting and Stopping Things

by cp409sd In reply to Starting and Stopping Thi ...

Point value changed by question poster.

Collapse -

Starting and Stopping Things

by ddiall In reply to Starting and Stopping Thi ...

Your problem is really a little strange... Now look, it's hard to guess what is going on, since manually the scripts work (start/stop parameter), the link names are ok (rc3.d/S98oradb and rc[06].d/K60oradb).

Try this: delete the links, double check r/x permissions on init.d/oradb and recreate the links (try hard instead of symlink).

Further, what I can suggest is tracing the script's execution and understand why yours in particular is not working. Make sure you know the init process, familiarize yourself with the contents of the /etc/rc.d/rc file and then try this:

# mkdir /tmp/init
# cd /tmp/init
# strace -ffo rc-out /etc/rc.d/rc 6

You'll get a lot of files in there, one for each process that /etc/rc.d/rc spawns during its execution. Browse them carefully until you are able to spot the glitch! To reduce the number of files, strip down the /etc/rc.d/rc6.d directory (delete some links and recreate them later).

Unfortunately that's all for now. give it a shot if you're desperate.

Collapse -

Starting and Stopping Things

by cp409sd In reply to Starting and Stopping Thi ...

Thanks so much for your help. After examining the contents of the rc-out files, I found that it was looking for a file named oradb located in /var/lock/subsys. So in my script I have it touch this file upon startup and remove it upon shutdown. Apperently this is how Linux deals with locks? Anyway, works great now. Thanks for the tips.

Collapse -

Starting and Stopping Things

by cp409sd In reply to Starting and Stopping Thi ...

This question was closed by the author

Back to Linux Forum
10 total posts (Page 1 of 1)  

Operating Systems Forums