Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Mail Systems
Eclipse Documentation

How To Guides
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Problem Solutions
Privacy Policy




Initialisation Scripts

A collection of initialisations are performed through running the script /etc/init.d/rcS as specified in the initialisation table (/etc/inittab) with the line:


The particular initialisations are performed through scripts located in the /etc/rcS.d/ folder. The names of these scripts are all of the form SNNmmmm where NN is numeric and mmmm is the name of some Debian package or application, such as setserial and hwclock. For example, you may find /etc/rcS.d/S30setserial and /etc/rcS.d/

The script /etc/init.d/rcS will ensure all of these scripts are run, one after another, in numeric and alphabetic order. Order is often important. Any script ending with .sh is sourced as a shell script and the others are run as commands. Irrespective of how the script is invoked it is passed the parameter start indicating that the service that the initialisation script represents is to be started in some sense. This is the meaning of the single S in the scrip file names and in the name of the rcS script.

You can add your own scripts into /etc/init.d/ folder and then link them appropriately to the particular run level directories. The update-rc.d command should be used to do this for you. Suppose you want to set up a firewall each time you boot the machine. You may create an executable script file called /etc/init.d/myfirewall (see Section 66.7 for sample contents). Then add this to the appropriate folders with:

  # update-rc.d myfirewall start 40 S . stop 89 0 6 .

This creates the following symbolic links:

   /etc/rc0.d/K89myfirewall -> ../init.d/myfirewall
   /etc/rc6.d/K89myfirewall -> ../init.d/myfirewall
   /etc/rcS.d/S40myfirewall -> ../init.d/myfirewall

Copyright © 1995-2006 [email protected]

  Published under the terms fo the GNU General Public License Design by Interspire