• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1403
  • Last Modified:

Startup Order for Sun Solaris w/ Respect to Script Execution

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
dhite99
Asked:
dhite99
  • 4
  • 2
  • 2
  • +1
2 Solutions
 
dhite99Author Commented:
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
 
slightwv (䄆 Netminder) Commented:
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
 
DavidSenior Oracle Database AdministratorCommented:
Do you understand the order in which the Oracle scripts are executed, and that RAC nodes require individual startups?
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
arnoldCommented:
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
 
dhite99Author Commented:
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
 
dhite99Author Commented:
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
 
slightwv (䄆 Netminder) Commented:
>>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
 
arnoldCommented:
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
 
dhite99Author Commented:
Excellent information, explanation, & references.

Thank you!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

  • 4
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now