Previous Page | Next Page

  1. Introduction
  2. Boot Process
  3. Init and System Initialization
  4. rc.sysinit script
  5. rc script
  6. functions script
  7. Services
  8. apm daemon
  9. network startup
  10. The network script file
  11. The network-functions file
  12. Portmap startup
  13. Random initialization
  14. Syslog initialization
  15. Gated
  16. Atd
  17. cron initialization
  18. pcmcia
  19. inetd daemon
  20. named daemon
  21. lpd daemon
  22. mars-nwe
  23. netfs startup
  24. dhcpd daemon
  25. autofs daemon
  26. keytable daemon
  27. sendmail daemon
  28. gpm daemon
  29. httpd daemon
  30. xfs startup
  31. smb startup
  32. innd startup
  33. linuxconf startup
  34. rc.local script
  35. Init, Getty, Login
  36. The shell
  37. Shutting down
  38. X
  39. Conclusions
  40. App A. rc.sysinit listing
  41. App B. functions listing
  42. App C. rc listing
  43. Credits

The final init script file

The file "/etc/rc.d/rc3.d/S99.local" is a link file to the file "/etc/rc.d/rc.local". Below is a listing of the "rc.local" file:

1	#!/bin/sh
3	# This script will be executed *after* all the other init scripts.
4	# You can put your own initialization stuff in here if you don't
5	# want to do the full Sys V style init stuff.
7	if [ -f /etc/redhat-release ]; then
8	    R=$(cat /etc/redhat-release)
10	    arch=$(uname -m)
11	    a="a"
12	    case "_$arch" in
13		    _a*) a="an";;
14		    _i*) a="an";;
15	    esac
17	    # This will overwrite /etc/issue at every boot.  So, make any changes you
18	    # want to make to /etc/issue here or you will lose them when you reboot.
19	    echo "" > /etc/issue
20	    echo "$R" >> /etc/issue
21	    echo "Kernel $(uname -r) on $a $(uname -m)" >> /etc/issue
23	    cp -f /etc/issue /etc/
24	    echo >> /etc/issue
25	fi

On line 7, the script file looks for the file "/etc/redhat-release" and assigns the contents of that file to the variable "R" on line 8. On line 10 the variable "arch" is assigned the machine type using the command "uname m". See the man page on uname for more information. The lines 10 through 15 set up the variable "a" to be an "a" or an "an" depending on the first character of the variable "arch" (the machine name). This is for later use when the kernel version and machine name are output to the issue files. On line 19, the "/etc/issue" file is cleared. On line 20, the Redhat release version is copied into the file. On line 21, the kernel version number and machine type are copied into the issue file. The issue file is output to the terminal by the getty (Note, in our case this is mingetty which is designated in the "/etc/inittab" file) program every time a user performs a login through a terminal. On line 23, the file "/etc/issue" is copied to the file "/etc/" which is used for network logins.