Performing Boot and Shutdown Procedures

Run Levels

0 -- ok mode
s or S Solaris OE single user mode with critical FS mounted
1 -- Single user administrative state with access to all FS available
2 -- Multiuser can access the system . All sys daemons are running except NFS
3 -- Multiuser operations with NFS & N/W resource available
4 -- Reserved
5 -- Poweroff
6 -- Reboot

# who –r -- Shows current run level

Boot Sequence

1. Boot PROM phase
2. Boot program phase
3. Kernel initialization phase
4. init phase

/etc/inittab -- id(S3) rstat(3) action(wait) Contains details about init levels

/etc/vfstab /etc/inittab /etc/system -- Important Files

/etc/system -- moddir root device and root FS config exclude forceload set

-- Always make a copy of /etc/system file before you edit the same. In case of problem , issue the interactive boot command : boot –a. When prompting for system file. Enter the path of backup file for /dev/null for a null configuration file.

/etc/init.d -- Directory contains many process or services like volume management

/sbin -- Each run level has an associated rc scripts located in this directory (eg /sbin/rc0)
The RC scripts rc0, rc5 & rc6 are hard linked to each other. Run control scripts
are located in /etc/init.d directory and these files are hard-linked to corresponding run control sctipts in the .etc.rc#.d directories.


Creating New Run Control Scripts

Create the script in the /etc/init.d directory and create links in the appropriate /etc/rc#.d directory for the run level in which the service is to be started and stop.

# vi /etc/init.d/filename
# chmod 744 /etc/init.d/filename
# chgrp sys /etc/init.d/filename
# cd /etc/init.d
# ln filename /etc/rc#.d/S##filename
# ln filename /etc/rc#.d/K##filename
# /etc/init.d/filename start -- To test the filename

# init 2 -- Switch the run level to 2

# shutdown -- Will moves to maintenance mode
# shutdown –y –g300 –i6 “The system is being rebooted” -- Reboots after 300 seconds.
Default is 60 sec
# shutdown –i0 (or) i5 (or) –i6

# halt -- Shutdown the system immediately to ok prompt
# poweroff -- Equivalent to init5
# reboot -- Equivalent to init6 -- These 3 commands won’t ececute rc0 kill scripts.
# reboot -- -r -- Reconfigration reboot.

No comments: