BSD−Like Initialization System V Initialization

..... ..... Not every rcn script has an associated rcn.d subdirectory there is simply no need for all of them; do not forget that rcn scripts can be written in a different way. Finally, the existing start and termination files in the rcn.d subdirectories represent hard links to the function−specific scripts residing in the depot directory etcinit.d this can be easily seen by using the ls −i command to check the files inode numbers. Obviously, both types of links can be equally implemented.

4.4.3 BSD−Like Initialization

The System V initialization approach dominates today, but it is hard to judge this approach as the better one overall. Sometimes the use of a few larger script files would be more convenient, versus the implementation of a multidirectory structure with many small script files. This is probably the reason that some hybrid solutions have appeared; some System V flavors made a compromise by introducing something of the BSD initialization spirit into a System V initialization body. They avoided a more complex multilayer initialization approach, and provided one or more larger script files for any run−level, which are directly invoked from the etcinittab file, or even coded in the startstop procedures. In this way, the System V initialization reminds us very much of the BSD one, with the occasional exception as to how the scripts are invoked. A substantial level of flexibility is preserved because the etcinittab file remains available. Such an approach characterized, for example, the HP−UX 9.0x, or IBM AIX 3.x platforms. Today, we can even recognize elements of such an organization in Linux. The HP−UX 9.0x platform included only a few rc script files with almost the same names as on the BSD platform. Some of them were even written as Korn shell scripts, which implies the Korn shell as the default one on the system. ls −l etcrc −r−xr−−r−− 1 bin bin 15988 Apr 4 11:10 etcrc −r−−r−−r−− 1 bin bin 21584 Mar 5 18:43 etcrc.utils −rw−rw−rw− 1 root root 0 May 4 11:23 etcrcflag This does not necessarily mean that the presented files are the only files used in the system initialization; other files with other names can be called by these rc files. If we take a look into the etcinittab file, we see a single inittab entry, named rc for this purpose. cat etcinittab init:4:initdefault: stty::sysinit:stty 9600 clocal icanon echo opost onlcr ienqak ixon icrnl ignpar devsystty brc1::bootwait: etcbcheckrc devconsole devconsole 21 fsck, etc. slib::bootwait:etcrecoversl devconsole devconsole 21 shared libs brc2::bootwait: etcbrc devconsole 21 boottime commands link::wait: binsh −c rm −f devsyscon; ln devsystty devsyscon devconsole 21 rc::wait: etcrc devconsole devconsole 21 system initialization powf::powerwait: etcpowerfail devconsole 21 power fail routines lp::off:nohup sleep 999999999 devlp stty 9600 devlp halt:6:wait: usrlibX11ignitionshutdown.ksh \ 105 invocation A similar situation was used by the AIX flavor with several more initialization script files: ls −l etcrc −r−xr−xr−− 1 bin bin 1750 Feb 10 1994 etcrc −r−xr−xr−− 1 bin bin 1866 Feb 10 1994 etcrc.bsdnet −rw−rwxr−− 1 root system 667 Feb 10 1994 etcrc.ncs −r−xr−xr−− 1 bin bin 7680 Feb 10 1994 etcrc.net −rwxr−xr−x 1 root system 2628 Jul 17 13:35 etcrc.nfs −rwxr−xr−x 1 root system 1161 Feb 12 1993 etcrc.pci −rwx−−−−−− 1 root system 20832 Feb 10 1994 etcrc.powerfail −rwxrwxr−− 1 root system 3950 Jul 17 13:35 etcrc.tcpip Most of the listed rc files are invoked directly through the inittab entries; others are called by the invoked files, which can be seen from the etcinittab file: cat etcinittab init:2:initdefault: brc::sysinit: etcbrc devconsole 21 phase 2 of system boot rc:2:wait: etcrc devconsole 21 multi−user checks rctcpip:2:wait: etcrc.tcpip devconsole 21 start TCPTP daemons rcnfs:2:wait: etcrc.nfs devconsole 21 start NFS daemons srcmstr:2:respawn: etcsrcmstr system resource controller cons::respawn: etcgetty devconsole cron:2:respawn: etccron periodic cron daemon qdaemon:2:once: binstartsrc −sqdaemon Linux implements three task−specific scripts: rc, rc.local, and rc.sysinit. They are located in the rc.d directory, out of individual rcn.d subdirectories. In the Linux rc directory structure shown earlier, the three files have special meaning. They are presented again here. ls −l etcrc.d ..... −rwxr−xr−x 1 root root 1871 Oct 15 1998 rc −rwxr−xr−x 1 root root 693 Oct 15 1998 rc.local −rwxr−xr−x 1 root root 7165 Oct 15 1998 rc.sysinit ..... ..... Their names strongly evoke old−style BSD rc organization, as does their purpose. Correspondingly, rc.local is assumed for a site−specific customization.

4.5 Shutdown Procedures