Go to TogaWare.com Home Page. GNU/Linux Desktop Survival Guide
by Graham Williams
Duck Duck Go



CLICK HERE TO VISIT THE UPDATED SURVIVAL GUIDE

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:

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

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/S50hwclock.sh.

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 58.17 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


Support further development by purchasing the PDF version of the book.
Other online resources include the Data Science Desktop Survival Guide.
Books available on Amazon include Data Mining with Rattle and Essentials of Data Science.
Popular open source software includes rattle and wajig.
Hosted by Togaware, a pioneer of free and open source software since 1984.
Copyright © 1995-2020 Togaware Pty Ltd. Creative Commons ShareAlike V4.