Linux - Special Files/Directories                                Home : www.sharetechnote.com

 

 

 

Followings are directories and files that are performing special roles. These are normally doing their jobs in the background. So you may have not recognized it, but they are very important.

 

 

inittab

: This is the example contents of inittab that came with the Linux (Debian) running on Beaglebone. This file is used in Step 4 of the process described in Boot Sequence page.

 

# /etc/inittab: init(8) configuration.

# $Id: inittab,v 1.91 2002/01/25 13:35:21 miquels Exp $

 

# The default runlevel.

id:2:initdefault:

 

# Boot-time system configuration/initialization script.

# This is run first except when booting in emergency (-b) mode.

si::sysinit:/etc/init.d/rcS

 

# What to do in single-user mode.

~~:S:wait:/sbin/sulogin

 

# /etc/init.d executes the S and K scripts upon change

# of runlevel.

#

# Runlevel 0 is halt.

# Runlevel 1 is single-user.

# Runlevels 2-5 are multi-user.

# Runlevel 6 is reboot.

 

l0:0:wait:/etc/init.d/rc 0

l1:1:wait:/etc/init.d/rc 1

l2:2:wait:/etc/init.d/rc 2

l3:3:wait:/etc/init.d/rc 3

l4:4:wait:/etc/init.d/rc 4

l5:5:wait:/etc/init.d/rc 5

l6:6:wait:/etc/init.d/rc 6

# Normally not reached, but fallthrough in case of emergency.

z6:6:respawn:/sbin/sulogin

 

# What to do when CTRL-ALT-DEL is pressed.

ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now

 

# Action on special keypress (ALT-UpArrow).

#kb::kbrequest:/bin/echo "Keyboard Request--edit /etc/inittab to let this work."

 

# What to do when the power fails/returns.

pf::powerwait:/etc/init.d/powerfail start

pn::powerfailnow:/etc/init.d/powerfail now

po::powerokwait:/etc/init.d/powerfail stop

 

# /sbin/getty invocations for the runlevels.

#

# The "id" field MUST be the same as the last

# characters of the device (after "tty").

#

# Format:

#  <id>:<runlevels>:<action>:<process>

#

# Note that on most Debian systems tty7 is used by the X Window System,

# so if you want to add more getty's go ahead but skip tty7 if you run X.

#

1:2345:respawn:/sbin/getty 38400 tty1

2:23:respawn:/sbin/getty 38400 tty2

3:23:respawn:/sbin/getty 38400 tty3

4:23:respawn:/sbin/getty 38400 tty4

5:23:respawn:/sbin/getty 38400 tty5

6:23:respawn:/sbin/getty 38400 tty6

 

# Example how to put a getty on a serial line (for a terminal)

#

#T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100

#T1:23:respawn:/sbin/getty -L ttyS1 9600 vt100

 

# Example how to put a getty on a modem line.

#

#T3:23:respawn:/sbin/mgetty -x0 -s 57600 ttyS3

 

 

T0:23:respawn:/sbin/getty -L ttyO0 115200 vt102

 

 

init

: this directory (/etc/init for Ubuntu) contains the configuration files for all the services and applications. it may be located in somewhere else in other Linux varient.

: This file is used in Step 7 of the process described in Boot Sequence page.

 

-rw-r--r-- 1 root root  320 Dec  8  2011 acpid.conf

-rw-r--r-- 1 root root  268 Apr  4  2012 alsa-restore.conf

-rw-r--r-- 1 root root  267 Apr  4  2012 alsa-store.conf

-rw-r--r-- 1 root root  278 Jun 20  2010 anacron.conf

-rw-r--r-- 1 root root 1309 Jan  2 15:35 apport.conf

-rw-r--r-- 1 root root  261 Oct 25  2011 atd.conf

-rw-r--r-- 1 root root  541 Oct 17  2011 avahi-daemon.conf

-rw-r--r-- 1 root root 1009 Mar  7  2012 bluetooth.conf

-rw-r--r-- 1 root root  266 Apr 16  2012 console.conf

-rw-r--r-- 1 root root  509 Dec 21  2010 console-setup.conf

-rw-r--r-- 1 root root 1122 Apr 16  2012 container-detect.conf

-rw-r--r-- 1 root root  356 Apr 16  2012 control-alt-delete.conf

-rw-r--r-- 1 root root  297 Apr  2  2012 cron.conf

-rw-r--r-- 1 root root 1814 Dec 12  2012 cups.conf

-rw-r--r-- 1 root root  510 Jan 10  2012 dbus.conf

-rw-r--r-- 1 root root  273 Mar 30  2012 dmesg.conf

-rw-r--r-- 1 root root 1377 Apr 16  2012 failsafe.conf

-rw-r--r-- 1 root root  380 Aug 30  2011 failsafe-x.conf

-rw-r--r-- 1 root root  267 Apr 16  2012 flush-early-job-log.conf

-rw-r--r-- 1 root root 1247 Mar 14  2012 friendly-recovery.conf

-rw-r--r-- 1 root root  317 May 26  2011 hostname.conf

-rw-r--r-- 1 root root  557 Mar 30  2012 hwclock.conf

-rw-r--r-- 1 root root  444 Mar 30  2012 hwclock-save.conf

-rw-r--r-- 1 root root  131 Sep 28  2012 hybrid-gfx.conf

-rw-r--r-- 1 root root  571 Feb  4  2012 irqbalance.conf

-rw-r--r-- 1 root root 1324 May 16 18:18 lightdm.conf

-rw-r--r-- 1 root root  349 Mar 24  2012 modemmanager.conf

-rw-r--r-- 1 root root  367 Mar 18  2011 module-init-tools.conf

-rw-r--r-- 1 root root  943 Apr 12  2012 mountall.conf

-rw-r--r-- 1 root root  349 Apr 12  2012 mountall-net.conf

-rw-r--r-- 1 root root  261 Apr 12  2012 mountall-reboot.conf

-rw-r--r-- 1 root root 1201 Apr 12  2012 mountall-shell.conf

-rw-r--r-- 1 root root  405 Apr 12  2012 mounted-debugfs.conf

-rw-r--r-- 1 root root  550 Apr 12  2012 mounted-dev.conf

-rw-r--r-- 1 root root  480 Apr 12  2012 mounted-proc.conf

-rw-r--r-- 1 root root  610 Apr 12  2012 mounted-run.conf

-rw-r--r-- 1 root root 1890 Apr 12  2012 mounted-tmp.conf

-rw-r--r-- 1 root root  903 Apr 12  2012 mounted-var.conf

-rw-r--r-- 1 root root  388 Apr  4  2012 networking.conf

-rw-r--r-- 1 root root  803 Apr  4  2012 network-interface.conf

-rw-r--r-- 1 root root  523 Apr  4  2012 network-interface-container.conf

-rw-r--r-- 1 root root 1603 Apr  4  2012 network-interface-security.conf

-rw-r--r-- 1 root root  568 Oct 10  2012 network-manager.conf

-rw-r--r-- 1 root root  534 Sep 12  2012 passwd.conf

-rw-r--r-- 1 root root  971 Nov  9  2011 plymouth.conf

-rw-r--r-- 1 root root  326 Mar 26  2010 plymouth-log.conf

-rw-r--r-- 1 root root  647 May  3 03:49 plymouth-ready.conf

-rw-r--r-- 1 root root  899 Mar 18  2011 plymouth-splash.conf

-rw-r--r-- 1 root root  800 Apr 13  2012 plymouth-stop.conf

-rw-r--r-- 1 root root  367 Jan 25  2011 plymouth-upstart-bridge.conf

-rw-r--r-- 1 root root  363 Dec  5  2011 procps.conf

-rw-r--r-- 1 root root  454 Apr 16  2012 rc.conf

-rw-r--r-- 1 root root  705 Apr 16  2012 rcS.conf

-rw-r--r-- 1 root root 1543 Apr 16  2012 rc-sysinit.conf

-rw-r--r-- 1 root root  457 Mar 29  2012 resolvconf.conf

-rw-r--r-- 1 root root  597 Mar 22  2012 rfkill-restore.conf

-rw-r--r-- 1 root root  469 Mar 22  2012 rfkill-store.conf

-rw-r--r-- 1 root root  426 Mar 30  2012 rsyslog.conf

-rw-r--r-- 1 root root  230 Mar 18  2011 setvtrgb.conf

-rw-r--r-- 1 root root  277 Apr 16  2012 shutdown.conf

-rw-r--r-- 1 root root  348 Apr 16  2012 tty1.conf

-rw-r--r-- 1 root root  333 Apr 16  2012 tty2.conf

-rw-r--r-- 1 root root  333 Apr 16  2012 tty3.conf

-rw-r--r-- 1 root root  333 Apr 16  2012 tty4.conf

-rw-r--r-- 1 root root  232 Apr 16  2012 tty5.conf

-rw-r--r-- 1 root root  232 Apr 16  2012 tty6.conf

-rw-r--r-- 1 root root  322 Dec 16  2011 udev.conf

-rw-r--r-- 1 root root  637 Apr  4  2012 udev-fallback-graphics.conf

-rw-r--r-- 1 root root  769 Aug 22  2011 udev-finish.conf

-rw-r--r-- 1 root root  356 Sep 29  2011 udevmonitor.conf

-rw-r--r-- 1 root root  352 Apr  4  2012 udevtrigger.conf

-rw-r--r-- 1 root root  473 Apr  5  2012 ufw.conf

-rw-r--r-- 1 root root  329 Apr 16  2012 upstart-socket-bridge.conf

-rw-r--r-- 1 root root  553 Apr 16  2012 upstart-udev-bridge.conf

-rw-r--r-- 1 root root  889 Feb  3  2012 ureadahead.conf

-rw-r--r-- 1 root root  683 Feb  3  2012 ureadahead-other.conf

-rw-r--r-- 1 root root  737 Jan  2  2012 vsftpd.conf

-rw-r--r-- 1 root root 1481 Apr 16  2012 wait-for-state.conf

-rw-r--r-- 1 root root  362 Apr 18  2012 whoopsie.conf

 

 

init.d

: the files (executables) located in this directory automatically runs at startup. In Ubuntu, init.d is under /etc.. it may be located in somewhere else in other Linux varient. It contains a number of start/stop scripts for various services on your system.

: '.d' here indicate 'directory'. Technically this suffix is not necessary because whether something is directory or a file is determined by the propery, but sometimes they put '.d' to make it easily recognizable.

: This file is used in Step 5 of the process described in Boot Sequence page.

 

Example :

Following is the result of 'ls /etc/init.d -al' on my Ubuntu

 

lrwxrwxrwx   1 root root    21 May 30 09:48 acpid -> /lib/init/upstart-job

-rwxr-xr-x   1 root root   652 Jan  4  2010 acpi-support

lrwxrwxrwx   1 root root    21 Mar 28 17:54 alsa-restore -> /lib/init/upstart-job

lrwxrwxrwx   1 root root    21 Mar 28 17:54 alsa-store -> /lib/init/upstart-job

lrwxrwxrwx   1 root root    21 May 30 09:48 anacron -> /lib/init/upstart-job

-rwxr-xr-x   1 root root  7621 Feb  6  2012 apache2 <-- web server

-rwxr-xr-x   1 root root  4596 Sep 25  2012 apparmor

lrwxrwxrwx   1 root root    21 Apr 11 13:15 apport -> /lib/init/upstart-job

lrwxrwxrwx   1 root root    21 May 30 09:48 atd -> /lib/init/upstart-job

lrwxrwxrwx   1 root root    21 May 30 09:48 avahi-daemon -> /lib/init/upstart-job

lrwxrwxrwx   1 root root    21 May 30 09:48 bluetooth -> /lib/init/upstart-job

-rwxr-xr-x   1 root root  2444 Apr 14  2012 bootlogd

-rwxr-xr-x   1 root root  2125 Mar  1  2011 brltty

lrwxrwxrwx   1 root root    21 May 30 09:48 console-setup -> /lib/init/upstart-job

lrwxrwxrwx   1 root root    21 May 30 09:48 cron -> /lib/init/upstart-job

lrwxrwxrwx   1 root root    21 May 13 11:06 cups -> /lib/init/upstart-job

lrwxrwxrwx   1 root root    21 May 30 09:48 dbus -> /lib/init/upstart-job

lrwxrwxrwx   1 root root    21 May  9 18:46 dmesg -> /lib/init/upstart-job

-rwxr-xr-x   1 root root  1242 Dec 13  2011 dns-clean

lrwxrwxrwx   1 root root    21 May  9 17:40 failsafe-x -> /lib/init/upstart-job

lrwxrwxrwx   1 root root    21 May 30 09:48 friendly-recovery -> /lib/init/upstart-job

-rwxr-xr-x   1 root root  1105 Jan 22 14:05 grub-common

-rwxr-xr-x   1 root root  1329 Apr 14  2012 halt

lrwxrwxrwx   1 root root    21 May 30 09:48 hostname -> /lib/init/upstart-job

lrwxrwxrwx   1 root root    21 May 30 09:48 hwclock -> /lib/init/upstart-job

lrwxrwxrwx   1 root root    21 May 30 09:48 hwclock-save -> /lib/init/upstart-job

lrwxrwxrwx   1 root root    21 May 30 09:48 irqbalance -> /lib/init/upstart-job

-rwxr-xr-x   1 root root  1893 Apr 18  2012 kerneloops

-rwxr-xr-x   1 root root  1293 Apr 14  2012 killprocs

-rw-r--r--   1 root root     0 Feb 13 17:07 .legacy-bootordering

lrwxrwxrwx   1 root root    21 May 16 18:19 lightdm -> /lib/init/upstart-job

lrwxrwxrwx   1 root root    21 May 30 09:48 modemmanager -> /lib/init/upstart-job

lrwxrwxrwx   1 root root    21 May 30 09:48 module-init-tools -> /lib/init/upstart-job

-rwxr-xr-x   1 root root  2797 Feb 13  2012 networking

lrwxrwxrwx   1 root root    21 May 30 09:48 network-interface -> /lib/init/upstart-job

lrwxrwxrwx   1 root root    21 May 30 09:48 network-interface-container -> /lib/init/upstart-job

lrwxrwxrwx   1 root root    21 May 30 09:48 network-interface-security -> /lib/init/upstart-job

lrwxrwxrwx   1 root root    21 May 30 09:48 network-manager -> /lib/init/upstart-job

-rwxr-xr-x   1 root root   882 Apr 14  2012 ondemand

-rwxr-xr-x   1 root root  2443 Jul  3  2011 openbsd-inetd <-- telnet server

lrwxrwxrwx   1 root root    21 May 30 09:48 passwd -> /lib/init/upstart-job

lrwxrwxrwx   1 root root    21 May 16 18:12 plymouth -> /lib/init/upstart-job

lrwxrwxrwx   1 root root    21 May 16 18:12 plymouth-log -> /lib/init/upstart-job

lrwxrwxrwx   1 root root    21 May 16 18:12 plymouth-ready -> /lib/init/upstart-job

lrwxrwxrwx   1 root root    21 May 16 18:12 plymouth-splash -> /lib/init/upstart-job

lrwxrwxrwx   1 root root    21 May 16 18:12 plymouth-stop -> /lib/init/upstart-job

lrwxrwxrwx   1 root root    21 May 16 18:12 plymouth-upstart-bridge -> /lib/init/upstart-job

-rwxr-xr-x   1 root root   561 Feb  4  2011 pppd-dns

lrwxrwxrwx   1 root root    21 May 30 09:48 procps -> /lib/init/upstart-job

-rwxr-xr-x   1 root root  2180 Dec  6  2012 pulseaudio

-rwxr-xr-x   1 root root  8635 Jul 26  2012 rc

-rwxr-xr-x   1 root root   801 Apr 14  2012 rc.local

-rwxr-xr-x   1 root root   117 Jul 26  2012 rcS

-rw-r--r--   1 root root  2427 Jul 26  2012 README

-rwxr-xr-x   1 root root   639 Apr 14  2012 reboot

lrwxrwxrwx   1 root root    21 May 30 09:48 resolvconf -> /lib/init/upstart-job

lrwxrwxrwx   1 root root    21 May 30 09:48 rfkill-restore -> /lib/init/upstart-job

lrwxrwxrwx   1 root root    21 May 30 09:48 rfkill-store -> /lib/init/upstart-job

-rwxr-xr-x   1 root root  4395 Nov  8  2011 rsync

lrwxrwxrwx   1 root root    21 May  9 18:46 rsyslog -> /lib/init/upstart-job

-rwxr-xr-x   1 root root  2344 Dec  4  2011 saned

-rwxr-xr-x   1 root root  4321 Apr 14  2012 sendsigs

lrwxrwxrwx   1 root root    21 May 30 09:48 setvtrgb -> /lib/init/upstart-job

-rwxr-xr-x   1 root root   590 Apr 14  2012 single

-rw-r--r--   1 root root  4304 Jul 26  2012 skeleton

-rwxr-xr-x   1 root root  2107 May 15  2011 speech-dispatcher

-rwxr-xr-x   1 root root   567 Apr 14  2012 stop-bootlogd

-rwxr-xr-x   1 root root  1143 Apr 14  2012 stop-bootlogd-single

-rwxr-xr-x   1 root root   700 Oct 26  2011 sudo

lrwxrwxrwx   1 root root    21 Mar 11 18:09 udev -> /lib/init/upstart-job

lrwxrwxrwx   1 root root    21 Mar 11 18:09 udev-fallback-graphics -> /lib/init/upstart-job

lrwxrwxrwx   1 root root    21 Mar 11 18:09 udov-finish -> /lib/init/upstart-job

lrwxrwxrwx   1 root root    21 Mar 11 18:09 udevmonitor -> /lib/init/upstart-job

lrwxrwxrwx   1 root root    21 Mar 11 18:09 udevtrigger -> /lib/init/upstart-job

lrwxrwxrwx   1 root root    21 May 30 09:48 ufw -> /lib/init/upstart-job

-rwxr-xr-x   1 root root  2800 Apr 14  2012 umountfs

-rwxr-xr-x   1 root root  2211 Apr 14  2012 umountnfs.sh

-rwxr-xr-x   1 root root  2926 Apr 14  2012 umountroot

-rwxr-xr-x   1 root root  1039 Nov  9  2011 unattended-upgrades

-rwxr-xr-x   1 root root  1985 Apr 14  2012 urandom

lrwxrwxrwx   1 root root    21 Mar 29  2012 vsftpd -> /lib/init/upstart-job <-- ftp server

lrwxrwxrwx   1 root root    21 May 30 09:48 whoopsie -> /lib/init/upstart-job

-rwxr-xr-x   1 root root  2666 Mar 22  2012 x11-common

 

 

rc.local

: This is a script file which is located in init.d directory. It usually run after all other service/executables in init.d execute. This file can be a best one in which you put your own stuffs to do something (e.g, run an executable, mounting instruction) during the startup.

: rc stands for 'run command'.. basically it implies this file would contain a bunch of shellscript

 

Example :

Following is the rc.local in my Ubuntu. This is default contents and I haven't put anything on my own yet.

 

#! /bin/sh

### BEGIN INIT INFO

# Provides:          rc.local

# Required-Start:    $remote_fs $syslog $all

# Required-Stop:

# Default-Start:     2 3 4 5

# Default-Stop:

# Short-Description: Run /etc/rc.local if it exist

### END INIT INFO

 

 

PATH=/sbin:/usr/sbin:/bin:/usr/bin

 

. /lib/init/vars.sh

. /lib/lsb/init-functions

 

do_start() {

        if [ -x /etc/rc.local ]; then

                [ "$VERBOSE" != no ] && log_begin_msg "Running local boot scrips (/etc/rc.local)"

                /etc/rc.local

                ES=$?

                [ "$VERBOSE" != no ] && log_end_msg $ES

                return $ES

        fi

}

 

case "$1" in

    start)

        do_start

        ;;

    restart|reload|force-reload)

        echo "Error: argument '$1' not supported" >&2

        exit 3

        ;;

    stop)

        ;;

    *)

        echo "Usage: $0 start|stop" >&2

        exit 3

        ;;

esac

 

 

rc

: rc stands for 'run command'.. basically it implies this file would contain a bunch of shellscript

:  This script runs various scripts based on run level. It configure the script differently based on rc0.d .. rc6.d. The number 0..6 here indicate the run level.

: This file is used in Step 6 of the process described in Boot Sequence page.

 

#! /bin/sh

#

# rc

#

# Starts/stops services on runlevel changes.

#

# Optimization: A start script is not run when the service was already

# configured to run in the previous runlevel.  A stop script is not run

# when the the service was already configured not to run in the previous

# runlevel.

#

# Authors:

#       Miquel van Smoorenburg <miquels@cistron.nl>

#       Bruce Perens <Bruce@Pixar.com>

 

PATH=/sbin:/usr/sbin:/bin:/usr/bin

export PATH

 

# Un-comment the following for interactive debugging. Do not un-comment

# this for debugging a real boot process as no scripts will be executed.

# debug=echo

 

# Specify method used to enable concurrent init.d scripts.

# Valid options are 'none' and 'makefile'.  Obsolete options

# used earlier are 'shell' and 'startpar'.  The obsolete options

# are aliases for 'makefile' since 2010-05-14.  The default since

# the same date is 'makefile', as the init.d scripts in Debian now

# include dependency information and are ordered using this

# information.  See insserv for information on dependency based

# boot sequencing.

CONCURRENCY=makefile

 

# Make sure the name survive changing the argument list

scriptname="$0"

 

umask 022

 

on_exit() {

        echo "error: '$scriptname' exited outside the expected code flow."

}

trap on_exit EXIT # Enable emergency handler

 

# Ignore CTRL-C only in this shell, so we can interrupt subprocesses.

trap ":" INT QUIT TSTP

 

# Set onlcr to avoid staircase effect.

stty onlcr 0>&1

 

# Functions for splash progress bars

if [ -e /lib/init/splash-functions-base ] ; then

        . /lib/init/splash-functions-base

else

        # Quiet down script if old initscripts version without /lib/init/splash-

functions-base is used.

        splash_progress() { return 1; }

        splash_stop() { return 1; }

fi

 

# Now find out what the current and what the previous runlevel are.

 

runlevel=$RUNLEVEL

# Get first argument. Set new runlevel to this argument.

[ "$1" != "" ] && runlevel=$1

if [ "$runlevel" = "" ]

then

        echo "Usage: $scriptname <runlevel>" >&2

        exit 1

fi

previous=$PREVLEVEL

[ "$previous" = "" ] && previous=N

 

export runlevel previous

 

if [ -f /etc/default/rcS ] ; then

        . /etc/default/rcS

fi

export VERBOSE

 

if [ -f /lib/lsb/init-functions ] ; then

        . /lib/lsb/init-functions

else

        log_action_msg() { echo $@; }

        log_failure_msg() { echo $@; }

        log_warning_msg() { echo $@; }

fi

 

#

# Stub to do progress bar ticks (for splash programs) on startup

#

startup_progress() {

        # Avoid divide by zero if anyone moved xdm/kdm/gdm first in a runlevel.

        if [ 0 -eq "$num_steps" ] ; then return; fi

 

        step=$(($step + $step_change))

        progress=$(($step * $progress_size / $num_steps + $first_step))

        $debug splash_progress "$progress" || true

}

 

#

# Check if we are able to use make like booting.  It require the

# insserv package to be enabled. Boot concurrency also requires

# startpar to be installed.

#

if [ "none" != "$CONCURRENCY" ] ; then

        test -s /etc/init.d/.depend.boot  || CONCURRENCY="none"

        test -s /etc/init.d/.depend.start || CONCURRENCY="none"

        test -s /etc/init.d/.depend.stop  || CONCURRENCY="none"

        if test -e /etc/init.d/.legacy-bootordering ; then

                CONCURRENCY="none"

        fi

        startpar -v      > /dev/null 2>&1 || CONCURRENCY="none"

fi

 

#

# Start script or program.

#

case "$CONCURRENCY" in

        makefile|startpar|shell) # startpar and shell are obsolete

                CONCURRENCY=makefile

                log_action_msg "Using makefile-style concurrent boot in runlevel

 $runlevel"

                # The splash API is not handled with this CONCURRENCY mode.

                # It need to be implented in startpar.  Until that is done

                # stop the splash screen before starting services, to avoid

                # usplash and X to confuse each other during boot.

                startup() {

                        if [ start = "$1" ] || [ boot = "$1" ]

                        then

                                $debug splash_stop || true

                        fi

                        eval "$(startpar -p 4 -t 20 -T 3 -M $1 -P $previous -R $runlevel)"

 

                        if [ -n "$failed_service" ]

                        then

                                log_failure_msg "startpar: service(s) returned failure: $failed_service"

                        fi

 

                        if [ -n "$skipped_service" ]

                        then

                                log_warning_msg "startpar: service(s) skipped: $skipped_service"

                        fi

 

                        unset failed_service skipped_service

                }

                ;;

        none|*)

                startup() {

                        action=$1

                        shift

                        scripts="$@"

                        for script in $scripts ; do

                                $debug "$script" $action

                                startup_progress

                        done

                }

                ;;

esac

 

# Check if the splash screen should be stopped before the given

# script.

is_splash_stop_scripts() {

        scriptname=$1

        case "$scriptname" in

                # killprocs is used in runlevel 1

                gdm|xdm|kdm|ltsp-client|ltsp-client-core|reboot|halt|killprocs)

                        return 0

                        ;;

        esac

        return 1

}

 

# Is there an rc directory for this new runlevel?

if [ -d /etc/rc$runlevel.d ]

then

        # Find out where in the progress bar the initramfs got to.

        PROGRESS_STATE=0

        if [ -f /dev/.initramfs/progress_state ]; then

                . /dev/.initramfs/progress_state

        fi

 

        # Split the remaining portion of the progress bar into thirds

        progress_size=$(((100 - $PROGRESS_STATE) / 3))

 

        case "$runlevel" in

                0|6)

                        ACTION=stop

                        # Count down from 0 to -100 and use the entire bar

                        first_step=0

                        progress_size=100

                        step_change=-1

                        ;;

                S)

                        ACTION=start

                        # Begin where the initramfs left off and use 2/3

                        # of the remaining space

                        first_step=$PROGRESS_STATE

                        progress_size=$(($progress_size * 2))

                        step_change=1

                        ;;

                *)

                        ACTION=start

                        # Begin where rcS left off and use the final 1/3 of

                        # the space (by leaving progress_size unchanged)

                        first_step=$(($progress_size * 2 + $PROGRESS_STATE))

                        step_change=1

                        ;;

        esac

 

        # Count the number of scripts we need to run

        # (for progress bars)

        num_steps=0

        for s in /etc/rc$runlevel.d/[SK]*; do

                if is_splash_stop_scripts "${s##/etc/rc$runlevel.d/S??}" ; then

                        break

                fi

                num_steps=$(($num_steps + 1))

        done

        step=0

 

        # First, run the KILL scripts.

        if [ makefile = "$CONCURRENCY" ]

        then

                if [ "$ACTION" = "start" ] && [ "$previous" != N ]

                then

                        startup stop

                fi

        elif [ "$previous" != N ]

        then

                # Run all scripts with the same level in parallel

                CURLEVEL=""

                for s in /etc/rc$runlevel.d/K*

                do

                        # Extract order value from symlink

                        level=${s#/etc/rc$runlevel.d/K}

                        level=${level%%[a-zA-Z]*}

                        if [ "$level" = "$CURLEVEL" ]

                        then

                                continue

                        fi

                        CURLEVEL=$level

                        SCRIPTS=""

                        for i in /etc/rc$runlevel.d/K$level*

                        do

                                # Check if the script is there.

                                [ ! -f $i ] && continue

 

                                #

                                # Find stop script in previous runlevel but

                                # no start script there.

                                #

                                suffix=${i#/etc/rc$runlevel.d/K[0-9][0-9]}

                                previous_stop=/etc/rc$previous.d/K[0-9][0-9]$suffix

                                previous_start=/etc/rc$previous.d/S[0-9][0-9]$suffix

                                #

                                # If there is a stop script in the previous level

                                # and _no_ start script there, we don't

                                # have to re-stop the service.

                                #

                                [ -f $previous_stop ] && [ ! -f $previous_start] && continue

 

                                # Stop the service.

                                SCRIPTS="$SCRIPTS $i"

                                if is_splash_stop_scripts "$suffix" ; then

                                        $debug splash_stop || true

                                fi

                        done

                        startup stop $SCRIPTS

                done

        fi

 

        if [ makefile = "$CONCURRENCY" ]

        then

                if [ S = "$runlevel" ]

                then

                        startup boot

                else

                        startup $ACTION

                fi

        else

                # Now run the START scripts for this runlevel.

                # Run all scripts with the same level in parallel

                CURLEVEL=""

                for s in /etc/rc$runlevel.d/S*

                do

                        # Extract order value from symlink

                        level=${s#/etc/rc$runlevel.d/S}

                        level=${level%%[a-zA-Z]*}

                        if [ "$level" = "$CURLEVEL" ]

                        then

                                continue

                        fi

                        CURLEVEL=$level

                        SCRIPTS=""

                        for i in /etc/rc$runlevel.d/S$level*

                        do

                                [ ! -f $i ] && continue

 

                                suffix=${i#/etc/rc$runlevel.d/S[0-9][0-9]}

                                if [ "$previous" != N ]

                                then

                                        #

                                        # Find start script in previous runlevel and

                                        # stop script in this runlevel.

                                        #

                                        stop=/etc/rc$runlevel.d/K[0-9][0-9]$suffix

                                        previous_start=/etc/rc$previous.d/S[0-9][0-9]$suffix

                                        #

                                        # If there is a start script in the previous level

                                        # and _no_ stop script in this level, we don't

                                        # have to re-start the service.

                                        #

                                        if [ start = "$ACTION" ] ; then

                                                [ -f $previous_start ] && [ ! -f  $stop ] && continue

                                        else

                                                # Workaround for the special

                                                # handling of runlevels 0 and 6.

                                                previous_stop=/etc/rc$previous.d/K[0-9][0-9]$suffix

                                                #

                                                # If there is a stop script in the previous level

                                                # and _no_ start script there, we don't

                                                # have to re-stop the service.

                                                #

                                                [ -f $previous_stop ] && [ ! -f $previous_start ] && continue

                                        fi

 

                                fi

                                SCRIPTS="$SCRIPTS $i"

                                if is_splash_stop_scripts "$suffix" ; then

                                        $debug splash_stop || true

                                fi

                        done

                        startup $ACTION $SCRIPTS

                done

        fi

fi

 

trap - EXIT # Disable emergency handler

 

exit 0

 

 

rc0.d

: rc stands for 'run command'.. '.d' indicate it is a directory. So, rc0.d indicate that it is a directory that contains a bunch of rc files.

 

lrwxrwxrwx 1 root root  17 Jun 25 00:46 K09apache2 -> ../init.d/apache2

lrwxrwxrwx 1 root root  29 May 30 09:48 K10unattended-upgrades -> ../init.d/unattended-upgrades

lrwxrwxrwx 1 root root  23 Jun 19 08:47 K20openbsd-inetd -> ../init.d/openbsd-inetd

lrwxrwxrwx 1 root root  27 May 30 09:48 K20speech-dispatcher -> ../init.d/speech-dispatcher

-rw-r--r-- 1 root root 353 Jul 26  2012 README

lrwxrwxrwx 1 root root  18 May 30 09:48 S20sendsigs -> ../init.d/sendsigs

lrwxrwxrwx 1 root root  17 May 30 09:48 S30urandom -> ../init.d/urandom

lrwxrwxrwx 1 root root  22 May 30 09:48 S31umountnfs.sh -> ../init.d/umountnfs.sh

lrwxrwxrwx 1 root root  20 May 30 09:48 S35networking -> ../init.d/networking

lrwxrwxrwx 1 root root  18 May 30 09:48 S40umountfs -> ../init.d/umountfs

lrwxrwxrwx 1 root root  20 May 30 09:48 S60umountroot -> ../init.d/umountroot

lrwxrwxrwx 1 root root  14 May 30 09:48 S90halt -> ../init.d/halt

 

 

rc1.d

 

lrwxrwxrwx 1 root root  17 Jun 25 00:46 K09apache2 -> ../init.d/apache2

lrwxrwxrwx 1 root root  20 May 30 09:48 K15pulseaudio -> ../init.d/pulseaudio

lrwxrwxrwx 1 root root  22 May 30 09:48 K20acpi-support -> ../init.d/acpi-support

lrwxrwxrwx 1 root root  20 May 30 09:48 K20kerneloops -> ../init.d/kerneloops

lrwxrwxrwx 1 root root  23 Jun 19 08:47 K20openbsd-inetd -> ../init.d/openbsd-inetd

lrwxrwxrwx 1 root root  15 May 30 09:48 K20saned -> ../init.d/saned

lrwxrwxrwx 1 root root  27 May 30 09:48 K20speech-dispatcher -> ../init.d/speech-dispatcher

-rw-r--r-- 1 root root 369 Jul 26  2012 README

lrwxrwxrwx 1 root root  19 May 30 09:48 S30killprocs -> ../init.d/killprocs

lrwxrwxrwx 1 root root  19 May 30 09:48 S70dns-clean -> ../init.d/dns-clean

lrwxrwxrwx 1 root root  18 May 30 09:48 S70pppd-dns -> ../init.d/pppd-dns

lrwxrwxrwx 1 root root  16 May 30 09:48 S90single -> ../init.d/single

 

 

rc2.d

 

-rw-r--r-- 1 root root 677 Jul 26  2012 README

lrwxrwxrwx 1 root root  20 May 30 09:48 S20kerneloops -> ../init.d/kerneloops

lrwxrwxrwx 1 root root  23 Jun 19 08:47 S20openbsd-inetd -> ../init.d/openbsd-inetd

lrwxrwxrwx 1 root root  27 May 30 09:48 S20speech-dispatcher -> ../init.d/speech-dispatcher

lrwxrwxrwx 1 root root  20 May 30 09:48 S50pulseaudio -> ../init.d/pulseaudio

lrwxrwxrwx 1 root root  15 May 30 09:48 S50rsync -> ../init.d/rsync

lrwxrwxrwx 1 root root  15 May 30 09:48 S50saned -> ../init.d/saned

lrwxrwxrwx 1 root root  19 May 30 09:48 S70dns-clean -> ../init.d/dns-clean

lrwxrwxrwx 1 root root  18 May 30 09:48 S70pppd-dns -> ../init.d/pppd-dns

lrwxrwxrwx 1 root root  14 May 30 02:49 S75sudo -> ../init.d/sudo

lrwxrwxrwx 1 root root  17 Jun 25 00:46 S91apache2 -> ../init.d/apache2

lrwxrwxrwx 1 root root  22 May 30 09:48 S99acpi-support -> ../init.d/acpi-support

lrwxrwxrwx 1 root root  21 May 30 09:48 S99grub-common -> ../init.d/grub-common

lrwxrwxrwx 1 root root  18 May 30 09:48 S99ondemand -> ../init.d/ondemand

lrwxrwxrwx 1 root root  18 May 30 09:48 S99rc.local -> ../init.d/rc.local

 

 

rc3.d

 

-rw-r--r-- 1 root root 677 Jul 26  2012 README

lrwxrwxrwx 1 root root  20 May 30 09:48 S20kerneloops -> ../init.d/kerneloops

lrwxrwxrwx 1 root root  23 Jun 19 08:47 S20openbsd-inetd -> ../init.d/openbsd-inetd

lrwxrwxrwx 1 root root  27 May 30 09:48 S20speech-dispatcher -> ../init.d/speech-dispatcher

lrwxrwxrwx 1 root root  20 May 30 09:48 S50pulseaudio -> ../init.d/pulseaudio

lrwxrwxrwx 1 root root  15 May 30 09:48 S50rsync -> ../init.d/rsync

lrwxrwxrwx 1 root root  15 May 30 09:48 S50saned -> ../init.d/saned

lrwxrwxrwx 1 root root  19 May 30 09:48 S70dns-clean -> ../init.d/dns-clean

lrwxrwxrwx 1 root root  18 May 30 09:48 S70pppd-dns -> ../init.d/pppd-dns

lrwxrwxrwx 1 root root  14 May 30 02:49 S75sudo -> ../init.d/sudo

lrwxrwxrwx 1 root root  17 Jun 25 00:46 S91apache2 -> ../init.d/apache2

lrwxrwxrwx 1 root root  22 May 30 09:48 S99acpi-support -> ../init.d/acpi-support

lrwxrwxrwx 1 root root  21 May 30 09:48 S99grub-common -> ../init.d/grub-common

lrwxrwxrwx 1 root root  18 May 30 09:48 S99ondemand -> ../init.d/ondemand

lrwxrwxrwx 1 root root  18 May 30 09:48 S99rc.local -> ../init.d/rc.local

 

 

rc4.d

 

-rw-r--r-- 1 root root 677 Jul 26  2012 README

lrwxrwxrwx 1 root root  20 May 30 09:48 S20kerneloops -> ../init.d/kerneloops

lrwxrwxrwx 1 root root  23 Jun 19 08:47 S20openbsd-inetd -> ../init.d/openbsd-inetd

lrwxrwxrwx 1 root root  27 May 30 09:48 S20speech-dispatcher -> ../init.d/speech-dispatcher

lrwxrwxrwx 1 root root  20 May 30 09:48 S50pulseaudio -> ../init.d/pulseaudio

lrwxrwxrwx 1 root root  15 May 30 09:48 S50rsync -> ../init.d/rsync

lrwxrwxrwx 1 root root  15 May 30 09:48 S50saned -> ../init.d/saned

lrwxrwxrwx 1 root root  19 May 30 09:48 S70dns-clean -> ../init.d/dns-clean

lrwxrwxrwx 1 root root  18 May 30 09:48 S70pppd-dns -> ../init.d/pppd-dns

lrwxrwxrwx 1 root root  14 May 30 02:49 S75sudo -> ../init.d/sudo

lrwxrwxrwx 1 root root  17 Jun 25 00:46 S91apache2 -> ../init.d/apache2

lrwxrwxrwx 1 root root  22 May 30 09:48 S99acpi-support -> ../init.d/acpi-support

lrwxrwxrwx 1 root root  21 May 30 09:48 S99grub-common -> ../init.d/grub-common

lrwxrwxrwx 1 root root  18 May 30 09:48 S99ondemand -> ../init.d/ondemand

lrwxrwxrwx 1 root root  18 May 30 09:48 S99rc.local -> ../init.d/rc.local

 

 

rc5.d

 

-rw-r--r-- 1 root root 677 Jul 26  2012 README

lrwxrwxrwx 1 root root  20 May 30 09:48 S20kerneloops -> ../init.d/kerneloops

lrwxrwxrwx 1 root root  23 Jun 19 08:47 S20openbsd-inetd -> ../init.d/openbsd-inetd

lrwxrwxrwx 1 root root  27 May 30 09:48 S20speech-dispatcher -> ../init.d/speech-dispatcher

lrwxrwxrwx 1 root root  20 May 30 09:48 S50pulseaudio -> ../init.d/pulseaudio

lrwxrwxrwx 1 root root  15 May 30 09:48 S50rsync -> ../init.d/rsync

lrwxrwxrwx 1 root root  15 May 30 09:48 S50saned -> ../init.d/saned

lrwxrwxrwx 1 root root  19 May 30 09:48 S70dns-clean -> ../init.d/dns-clean

lrwxrwxrwx 1 root root  18 May 30 09:48 S70pppd-dns -> ../init.d/pppd-dns

lrwxrwxrwx 1 root root  14 May 30 02:49 S75sudo -> ../init.d/sudo

lrwxrwxrwx 1 root root  17 Jun 25 00:46 S91apache2 -> ../init.d/apache2

lrwxrwxrwx 1 root root  22 May 30 09:48 S99acpi-support -> ../init.d/acpi-support

lrwxrwxrwx 1 root root  21 May 30 09:48 S99grub-common -> ../init.d/grub-common

lrwxrwxrwx 1 root root  18 May 30 09:48 S99ondemand -> ../init.d/ondemand

lrwxrwxrwx 1 root root  18 May 30 09:48 S99rc.local -> ../init.d/rc.local

 

 

rc6.d

 

lrwxrwxrwx 1 root root  17 Jun 25 00:46 K09apache2 -> ../init.d/apache2

lrwxrwxrwx 1 root root  29 May 30 09:48 K10unattended-upgrades -> ../init.d/unattended-upgrades

lrwxrwxrwx 1 root root  23 Jun 19 08:47 K20openbsd-inetd -> ../init.d/openbsd-inetd

lrwxrwxrwx 1 root root  27 May 30 09:48 K20speech-dispatcher -> ../init.d/speech-dispatcher

-rw-r--r-- 1 root root 351 Jul 26  2012 README

lrwxrwxrwx 1 root root  18 May 30 09:48 S20sendsigs -> ../init.d/sendsigs

lrwxrwxrwx 1 root root  17 May 30 09:48 S30urandom -> ../init.d/urandom

lrwxrwxrwx 1 root root  22 May 30 09:48 S31umountnfs.sh -> ../init.d/umountnfs.sh

lrwxrwxrwx 1 root root  20 May 30 09:48 S35networking -> ../init.d/networking

lrwxrwxrwx 1 root root  18 May 30 09:48 S40umountfs -> ../init.d/umountfs

lrwxrwxrwx 1 root root  20 May 30 09:48 S60umountroot -> ../init.d/umountroot

lrwxrwxrwx 1 root root  16 May 30 09:48 S90reboot -> ../init.d/reboot