sections in this module | City
College of San Francisco - CS260A Unix/Linux System Administration Module: StartupShutdown II |
module list |
Customizing the Boot Process
Preview question: Suppose you wanted to add your own sequence of code to be executed when the system boots. Can you think of ways to configure this? |
It is possible to add your own item to the boot process. There are three standard ways of configuring this to avoid conflict with standard software:
create your own upstart job or configure upstart to run an external script for you.
create a subsystem of your own. This is useful especially if your customization involves a daemon process. If the program is not already packaged as a subsystem you can create your own by taking a simple subsystem script and modifying it.
if your modifications consist of some commands that simply must be run as part of the startup process, you can use the existing (empty) rc.local script. This script is executed as if it is a subsystem if it is configured with start links in the rcX.d directories. Note that this script isn't really a subsystem, so start links are really a misnomer. Since the rc.local script is just a bunch of commands to execute, it ignores the start and stop arguments. Irrespective of their names, symlinks are just used to trigger the execution of the script. Thus, since all symlinks are implicitly start links, they should always be prefixed with S.
When installed, the rc.local script is empty, and it is configured to be started at all multiuser runlevels with the latest start order possible:
$ cd /etc/rc.d
$ ls -l rc.local rc?.d/*local
lrwxrwxrwx 1 root root 11 Jun 1 2008
rc2.d/S99local -> ../rc.local
lrwxrwxrwx 1 root root 11 Jun 1 2008
rc3.d/S99local -> ../rc.local
lrwxrwxrwx 1 root root 11 Jun 1 2008
rc4.d/S99local -> ../rc.local
lrwxrwxrwx 1 root root 11 Jun 1 2008
rc5.d/S99local -> ../rc.local
-rwxr-xr-x 1 root root 220 Mar 3 2008 rc.local
And it contains:
$ more rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
$
Preview question:
The system boot loader is named grub. Find its manual on the Internet
and read the introduction. (Note: our version is 0.97. Make
sure you read the correct manual.) |
Prev | This page was made entirely
with free software on linux: Kompozer and Openoffice.org |
Next |