A /etc/rc... boot scriptek. (részletek)

#! /bin/sh
#
# /etc/rc.d/rc.S:  System initialization script.
...
# enable swapping
/sbin/swapon -a
/sbin/swapon /PAFE
...
# mount file systems in fstab (and create an entry for /)
# but not NFS because TCP/IP is not yet configured
/sbin/mount -avt nonfs

# rc.K This file is executed by init when it goes into runlevel
#       1, which is the administrative state. It kills all
#       deamons and then puts the system into single user mode.
#       Note that the file systems are kept mounted.
...
# Kill all processes.
echo
echo "Sending all processes the TERM signal."
kill -15 -1
echo -n "Waiting for processes to terminate"
for loop in 0 1 2 3 4 5 6 7 ; do
  sleep 1
  echo -n "."
done
echo
...
echo "Sending all processes the KILL signal."
kill -9 -1

# rc.M  This file is executed by init(8) when the system is being
#       initialized for one of the "multi user" run levels (i.e.
#       levels 1 through 6).  It usually does mounting of file
#       systems et al.
...
# Screen blanks after 15 minutes idle time.
/bin/setterm -blank 15
...
# Ensure basic filesystem permissions sanity.
chmod 755 /
chmod 1777 /tmp /var/tmp
...
# Start the sendmail daemon:
if [ -x /usr/sbin/sendmail ]; then
  echo "Starting sendmail daemon (/usr/sbin/sendmail -bd -q15m)..."
  /usr/sbin/sendmail -bd -q15m
fi
...
# Load a custom screen font if the user has an rc.font script.
if [ -x /etc/rc.d/rc.font ]; then
  . /etc/rc.d/rc.font
fi
...
# Start Web server:
# = /var/lib/apache/sbin/apachectl start
if [ -x /etc/rc.d/rc.httpd ]; then
  . /etc/rc.d/rc.httpd
fi
...
# Load a custom keymap if the user has an rc.keymap script.
if [ -x /etc/rc.d/rc.keymap ]; then
  . /etc/rc.d/rc.keymap
fi
...
# Start the local setup procedure.
if [ -x /etc/rc.d/rc.local ]; then
  . /etc/rc.d/rc.local
fi

lrwxrwxrwx   1 root   root        4 Apr  7  1999 rc.0 -> rc.6
-rwxr-xr-x   1 root   root     2376 May 26  1998 rc.6

# rc.6  This file is executed by init when it goes into runlevel
#       0 (halt) or runlevel 6 (reboot). It kills all processes,
#       unmounts file systems and then either halts or reboots.

# Find out how we were called.
case "$0" in
      *0) message="The system is halted."
          command="halt" ;;
      *6) message="Rebooting."
          command=reboot ;;
       *) echo "$0: call me as \"rc.0\" or \"rc.6\" please!"
          exit 1 ;;
esac

# Kill all processes.
#      killall5 -- send a signal to all processes.
if [ "$1" != "fast" ]; then # shutdown did not already kill all processes
  killall5 -15 
  killall5 -9
fi
...
# Now halt or reboot.
echo "$message"
[ ! -f /etc/fastboot ] && echo "On the next boot fsck will be FORCED."
$command -f

Csizmazia Albert csa@inf.elte.hu