UNIX Startup and Shutdown CSCI N 321 System

















![Virtual Consoles Started in /etc/event. d/tty[1 -6]: Example (tty 2): start on on stopped Virtual Consoles Started in /etc/event. d/tty[1 -6]: Example (tty 2): start on on stopped](https://slidetodoc.com/presentation_image_h2/65e380466732fe922e79bfd54ab2e94a/image-18.jpg)
![Strarting/Stopping Run Levels Started in /etc/event. d/rc[0 -6, S]: Example (rc 3): start on Strarting/Stopping Run Levels Started in /etc/event. d/rc[0 -6, S]: Example (rc 3): start on](https://slidetodoc.com/presentation_image_h2/65e380466732fe922e79bfd54ab2e94a/image-19.jpg)

![Startup Messages Displayed to console Red. Hat – daemon [ ok ] /bin/dmesg n Startup Messages Displayed to console Red. Hat – daemon [ ok ] /bin/dmesg n](https://slidetodoc.com/presentation_image_h2/65e380466732fe922e79bfd54ab2e94a/image-21.jpg)


- Slides: 23
UNIX Startup and Shutdown CSCI N 321 – System and Network Administration Copyright © 2000, 2009 by Scott Orr and the Trustees of Indiana University
Section Overview Bootstrapping Startup Scripts and Run Levels Boot Configuration and Troubleshooting System Shutdown
References CQU COIT 13146 System Administration Course Textbook Lectures w. Chapter w 2002 13 #12
Monolithic vs. Microkernels Source: http: //en. wikipedia. org/wiki/Microkernel
Bootstrapping Starting the system Process of loading kernel into memory Boot Modes n n n Normal Single User Rescue (on CD)
Red. Hat Boot Process BIOS GRUB /etc/rc. d/ rc 3. d /etc/inittab Linux Kernel init /etc/rc. d/ rc. sysinit /etc/rc. d/rc Login Shell RL Specific /etc/inittab /etc/rc. d/ rc 5. d Source: http: //nmc. nchu. edu. tw/linux/Linux_boot. htm
Fedora Boot Process BIOS GRUB /etc/rc. d/ rc 3. d /etc/inittab Linux Kernel init Login Shell /etc/ event. d/* RL Specific /etc/rc. d/ rc 5. d Source: http: //nmc. nchu. edu. tw/linux/Linux_boot. htm
Boot Process Load & initialize kernel Detect & configure devices Fork system processes (Stop if Single User mode) Run startup scripts Start multiuser operations
Boot Loader ROM loads boot program from disk Boot program finds/loads kernel n n Checks available memory Initializes kernel internal data structures GRand Unified Bootloader (GRUB) n n Can boot multiple OS Boot options can be edited at boot Linux Boot Loader (LILO) n n n Can boot multiple OS Single User: linux single Rescue: linux rescue
/etc/grub. conf default=1 timeout=10 splashimage=(hd 0, 5)/boot/grub/splash. xpm. gz title Fedora Core - N 321 (2. 6. 11 -1. 1369_FC 4) root (hd 0, 5) kernel /boot/vmlinuz-2. 6. 11 -1. 1369_FC 4 ro root=LABEL=/1 rhgb quiet initrd /boot/initrd-2. 6. 11 -1. 1369_FC 4. img title Windows XP rootnoverify (hd 0, 0) chainloader +1 title Red Hat Enterprise WS (2. 6. 9 -11. EL) rootnoverify (hd 0, 4) kernel /boot/vmlinuz-2. 6. 9 -11. EL ro root=LABEL=/ rhgb quiet initrd /boot/initrd-2. 6. 9 -11. EL. img
System Processes BSD Systems n n n swapper – PID 0 init – PID 1 pagedaemon – PID 2 AT&T SVR 4 n n n sched – PID 0 (invisible under Red. Hat) init – PID 1 /etc/inittab
Startup Scripts Hostname Timezone Check the hard drives Mount the hard drives Remove files from /tmp Configure network interfaces Start daemons and network services
BSD /etc/rc* Scripts /etc/rc n n Master script Executes supplemental scripts Example supplemental scripts (free. BSD) n n n /etc/defaults/rc. conf /etc/rc. conf. local
/etc/inittab Initializes system for use Format: id: rl: action: process n n id: uniquely identifies entry rl: Run level entry applies to action: How to execute process: process command line Ex: Setting the default Runlevel: id: 3: initdefault:
Startup Run Levels Solaris 1 (S) 2 3 Red. Hat 1 (S) 2 3 4 5 4 6 0 5 6 0 Mode Single user Multiuser (no networking) Full Multiuser Unused Power-off shutdown X 11 Reboot Halt
Event file directives exec script start on <event> stop on <event> daemon respawn service
“Events” control-alt-delete power-status-changed startup runlevel <runlevel> started <job> stopped <job>
Virtual Consoles Started in /etc/event. d/tty[1 -6]: Example (tty 2): start on on stopped started rc 2 rc 3 rc 4 prefdm stop on runlevel 0 stop on runlevel 1 stop on runlevel 6 respawn exec /sbin/mingetty 2
Strarting/Stopping Run Levels Started in /etc/event. d/rc[0 -6, S]: Example (rc 3): start on runlevel 3 stop on runlevel [!3] console output script set $(runlevel --set 3 || true) if [ "$1" != "unknown" ]; then PREVLEVEL=$1 RUNLEVEL=$2 export PREVLEVEL RUNLEVEL fi exec /etc/rc. d/rc 3 end script
Run Level Scripts Actual scripts - /etc/rc. d/init. d/ /etc/rc. d/rc#. d/ n n Symbolic links to /etc/init. d scripts S## - Start scripts K## - Stop scripts /etc/sysconfig/ - script configuration files chkconfig <script> on|off service <script> start|stop|restart
Startup Messages Displayed to console Red. Hat – daemon [ ok ] /bin/dmesg n n History of boot messages Convenient to search Red. Hat allows for interactive setup (“i”)
System Shutdown Turn off power – BAD!!! Reboot n n reboot shutdown –r Halting the system n n halt shutdown –h Changing the Run Level n n telinit <mode> shutdown –i<mode>
When to Shutdown Failures Maintenance and Upgrades Regularly Scheduled n n Housecleaning Window for Maintenance/Upgrades User Notification n /etc/motd Email Support web pages