INIT commands with Solaris.

INIT commands initializes the commands which are scheduled and run accordingly to get the required results. INIT is also known as first process in UNIX and Linux operating systems.

This command below represents the process PID 1

[symple_box color=”gray” text_align=”left” width=”100%” float=”none”]

bash-3.2# which init

/usr/sbin/init

The INIT’s config file can be located in

bash-3.2# cat /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

[/symple_box]

INIT’s config file above has the list of various runlevels which run the restart, shutdown, multi-user support with networking etc. This file is basically a table which gets the details of the commands which need to be executed and are in a queue to start the service accordingly.

There are various INIT Runlevels available from 0-S

0 – shutdown

1 – single user mode(no networking support)

2 – multi-user support without NFS

3 – multi-user support with NFS (default)

4 – unused – used by application vendors

5 – interactive boot

6 – reboot

S – single user mode(no networking support)

To check the current and previous runlevels use the command below which works in Unix(Solaris, AIX) and Linux(RHEL, Cent OS).

[symple_box color=”gray” text_align=”left” width=”100%” float=”none”]

bash-3.2# who -r

  .       run-level 3  Feb  2 02:59     3      0  S

[/symple_box]

You can find many INIT files in

[symple_box color=”gray” text_align=”left” width=”100%” float=”none”]

bash-3.2# cd /etc/init.d/

bash-3.2# ls

PRESERVE         dhcp             lu               slpd

README           dodatadm.udaplt  mipagent         swupboots

acct             drvconfig        mkdtab           sysetup

acctadm          dtlogin          ncakmod          ufs_quota

apache           init.dmi         ncalogd          uucp

autoinstall      init.sma         nfs.server       vmware-tools

boot.server      init.snmpdx      nscd             volmgt

cachefs.daemon   init.wbem        pcmcia

deallocate       ldap.client      pppd

devlinks         llc2             sendmail

[/symple_box]

You can even find the shell scripts of the runlevels as shown below.

[symple_box color=”gray” text_align=”left” width=”100%” float=”none”]

bash-3.2# cd /sbin/

bash-3.2#

bash-3.2# ls -l rc?

-rwxr–r–   3 root     sys         1983 Jan 22  2005 rc0

-rwxr–r–   1 root     sys         2242 Jan 22  2005 rc1

-rwxr–r–   1 root     sys         2536 Jan 22  2005 rc2

-rwxr–r–   1 root     sys         2567 Jan 22  2005 rc3

-rwxr–r–   3 root     sys         1983 Jan 22  2005 rc5

-rwxr–r–   3 root     sys         1983 Jan 22  2005 rc6

-rwxr–r–   1 root     sys         5125 Jan 22  2005 rcS

bash-3.2#

bash-3.2# file rc?

rc0:            executable /sbin/sh script

rc1:            executable /sbin/sh script

rc2:            executable /sbin/sh script

rc3:            executable /sbin/sh script

rc5:            executable /sbin/sh script

rc6:            executable /sbin/sh script

rcS:            executable /sbin/sh script

bash-3.2# less rc0
[/symple_box]

[symple_divider style=”solid” margin_top=”20px” margin_bottom=”20px”]

[symple_box color=”gray” text_align=”left” width=”100%” float=”none”]

If you like the blog please follow us [icon name=”icon-facebook”] [icon name=”icon-twitter”] [icon name=”icon-google-plus-sign”]

[/symple_box]