Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Startup Order for Sun Solaris w/ Respect to Script Execution

Posted on 2012-09-18
9
Medium Priority
?
1,378 Views
Last Modified: 2012-09-19
System info:

SunOS bartx041 5.10 Generic_147440-12 sun4u sparc SUNW,Sun-Fire-V490

What I need to know is the order solaris executes the various scripts that start things like oracle databases, etc., and the order in which scripts are executed on system shutdown and where they're located.

I see in /etc there is an init.d, but there are also rc<n>.d directories, where <n> is 0-6 and "S":

rc0 -> ../sbin/rc0*
rc1 -> ../sbin/rc1*
rc2 -> ../sbin/rc2*
rc3 -> ../sbin/rc3*
rc5 -> ../sbin/rc5*
rc6 -> ../sbin/rc6*
rcS -> ../sbin/rcS*
rc0.d/
rc1.d/
rcS.d/
rc2.d/
rc3.d/

there are some "S" and "K" prefixed files in the rc<n>.d - one of the files looks to be the oracle database startup/shutdown - I guess what would help at this point is to understand the order that solaris executes the scripts in each of the init.d, rc<n>.d, etc.

Any help is as always appreciated.
0
Comment
Question by:dhite99
  • 4
  • 2
  • 2
  • +1
9 Comments
 

Author Comment

by:dhite99
ID: 38411440
Update:

Here is what I see with respect to this oracle startup/shutdown script: There seem to be a lot of copies in these directories - if you could clue me in to what is going on with all of this, I would appreciate it.

/rcS.d/K88DMoracle
/rc1.d/K88DMoracle
/rc2.d/S88DMoracle
/rc2.d/K88DMoracle
/rc3.d/S88DMoracle
/init.d/DMoracle
0
 
LVL 78

Expert Comment

by:slightwv (䄆 Netminder)
ID: 38411465
The rc#.d the # is the Unix run level.  They startup from 1 to whatever run level you specify.  The stop in reverse order.

The S & K scripts are set up to 'S'tart and 'K'ill.  They should add up to be 999 or 900 ( I forget which) so the startup in one order and stop in the opposite order.  They are executed in order so for example if the S script is 001 the K script would be 998.
0
 
LVL 23

Expert Comment

by:David
ID: 38411595
Do you understand the order in which the Oracle scripts are executed, and that RAC nodes require individual startups?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 81

Assisted Solution

by:arnold
arnold earned 800 total points
ID: 38411950
Solaris 10 has legacy startup scripts which referenced, it also has startup process managed by svcadm manager.
The legacy startup scripts are started based on the run level as pointed out.
The runlevel is set in /etc/inittab
3 is multi user non graphical mode, while run level 5 is multiuser graphical mode.

The order is from S00 to S99 the scripts have to have execute bit set. When shutdown/restart the scripts are executed in the reverse order as pointed out earlier k99-k00

In either case of using svcadm or legacy scripts, starting any service/application, you should configure it to start after any service, device on which it depends. I.e. a network dependent application should be somewhere I the higher S40s I think S40network
At times applications, apache, MySQL, oracle, etc should be in the 80 and higher range to make sure everything is already up.

To the other point, the K scripts will exist often in all levels going down from which the startup script is setup. This is to provide a mechanism for the system to shutdown services when the runlevel is reduced.
I.e. you are in runlevel 3 and need to perform maintenance Solaris patch install, system cleanup, etc. you would on the console run init 1 to drop to single user.
At this point most applications have to be terminated apache, oracle, MySQL, etc.
The reduction to runlevel preserves the mount points that might not be if you reboot the system into single user.

Once the maintenance is complete you can Raise it back

Doing the same using svcadm can be seen at
http://sysadminwiki.net/wiki/index.php?title=Solaris_10_Run_level_Management
0
 

Author Comment

by:dhite99
ID: 38413402
Thanks all for comments -

Arnold - couple of follow-on questions:

Here is what is in /etc/inittab:

# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#
# The /etc/inittab file controls the configuration of init(1M); for more
# information refer to init(1M) and inittab(4).  It is no longer
# necessary to edit inittab(4) directly; administrators should use the
# Solaris Service Management Facility (SMF) to define services instead.
# Refer to smf(5) and the System Administration Guide for more
# information on SMF.
#
# For modifying parameters passed to ttymon, use svccfg(1m) to modify
# the SMF repository. For example:
#
#       # svccfg
#       svc:> select system/console-login
#       svc:/system/console-login> setprop ttymon/terminal_type = "xterm"
#       svc:/system/console-login> exit
#
#ident  "@(#)inittab    1.41    04/12/14 SMI"
ap::sysinit:/sbin/autopush -f /etc/iu.ap
sp::sysinit:/sbin/soconfig -f /etc/sock2path
smf::sysinit:/lib/svc/bin/svc.startd    >/dev/msglog 2<>/dev/msglog </dev/console
p3:s1234:powerfail:/usr/sbin/shutdown -y -i5 -g0 >/dev/msglog 2<>/dev/msglog
pt:s1234:powerfail:/usr/lib/svc/method/installupdates lock   

Open in new window


Can you identify what runlevel is set from the above? I cannot seem to see it.

In addition, regarding the svcadm manager - how would I determine if that is being used and what it executes (if anything) in addition to the legacy startup scripts?

Thanks!
0
 

Author Comment

by:dhite99
ID: 38413431
One other question - if I am reading the comment from slightwv  correctly, it executes all of the "S" prefixed scripts beginning at run level 1, then 2, then 3, and so on. This is to say that the "S" scripts get executed in all of the runlevels if the system is starting up. Is this correct, or does the runlevel get set to one single static number, and only those "S" scripts get executed on startup (for example, statically set the runlevel to 3, then only the scripts in RC3.d)?
0
 
LVL 78

Accepted Solution

by:
slightwv (䄆 Netminder) earned 1200 total points
ID: 38413508
>>Can you identify what runlevel is set from the above? I cannot seem to see it.

Looks like it is the 'default' for solaris since it isn't in there.

Check out:
http://www.cyberciti.biz/tips/solaris-run-level-change.html


>>or does the runlevel get set to one single static number

Yes.  The server can only be running at a single run level.

>>(for example, statically set the runlevel to 3, then only the scripts in RC3.d)?

All rc.d folders UP TO run level 3 get executed in order:
rc1.d form the lowest S number to the larges S number
then rc2.d from the lowest to the largest
then rc3.d from the lowest to the largest.

On shutdown it goes in reverse order:
rc3.d K scripts from the largest to lowest
then rc2.d from largest to lowest
then rc1.d larget to lowest.

Example:
rc1.d has:
S01scriptA
S02scriptB
K98scriptB
K99scriptA

rc2.d has:
S01scriptC
K99scriptC

rc2.d has:
S01scriptD
K99scriptD

The default runlevel is 3.

Startup will run these in order:
S01scriptA
S02scriptB
S01scriptC
S01scriptD

Shutdown in order:
K99scriptD
K99scriptC
K99scriptA
K98scriptB
0
 
LVL 81

Expert Comment

by:arnold
ID: 38413574
The above only deals with the legacy scripts.
A similar process exists within the newer service management system which are usually executed first.
i.e. at runlevel1 svcadm based startup processes run, then the rc1.d, then runlevel2 and rc2.d and runlevel3 and rc3.d.


svcs can be used to query the installed/status of apps/services
http://unix.stackexchange.com/questions/21520/solaris-get-a-list-of-the-commands-run-at-startup-boot
http://www.princeton.edu/~unix/Solaris/troubleshoot/smf.html

To control runlevel on Solaris 10 uses smf.
http://www.linuxquestions.org/questions/solaris-opensolaris-20/default-run-level-550412/
svcadm milestone -d milestone/single-user:default will change the default runlevel on boot to single user.
0
 

Author Closing Comment

by:dhite99
ID: 38414916
Excellent information, explanation, & references.

Thank you!
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The purpose of this article is to demonstrate how we can use conditional statements using Python.
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.
Suggested Courses
Course of the Month12 days, 11 hours left to enroll

579 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question