7.4. Creating the rcS script

The second main bootscript is the rcS script. Create a new file /etc/init.d/rcS containing the following:


cat > rcS << "EOF"
#!/bin/sh
# Begin /etc/init.d/rcS

#
# See the rc script for the extensive comments on the constructions
# used here
#

runlevel=S
prevlevel=N
umask 022
export runlevel prevlevel

trap ":" INT QUIT TSTP

#
# Collect all the S scripts in /etc/rcS.d and execute them in the same
#

for i in /etc/rcS.d/S??*
do
        [ ! -f  "$i" ] && continue;
                $i start
done

# End /etc/init.d/rcS
EOF