Chapter 6. Automating Startup & Shutdown
6.1. Analysis
The root disk from the last chapter is looking pretty good. It has about seventy percent of the commands that
the Filesystem Hierarchy Standard (FHS) document requires for the root filesystem. Plus it has commands for
checking and mounting filesystems. But even with all of this the root disk is far from perfect. The list below
outlines three things that could use some improvement if the Pocket Linux system is to stand up next to the
more professional looking distributions.
The system currently requires the kernel parameters to be typed at the
grub>
prompt in order to start
properly. On any other GNU/Linux system this is only done in an emergency situation when the
system is corrupted.
1.
Checking and mounting the root filesystem has to be done manually by running a script at a shell
prompt. On most modern operating systems this function is handled automatically as part of the
system start−up process.
2.
Using CTRL−ALT−DELETE for system shutdown is not very graceful. Filesystems should be
unmounted and cached information should be flushed prior to shutdown. Again, this is something that
most operating systems handle automatically.
3.
Taking the above list into consideration, the goals for this phase are defined as follows:
Kernel loads without manual intervention.
•
Automated system start−up sequence.
•
Graceful shutdown capability.
•
6.2. Design
6.2.1. Determining necessary utilities
Loading the kernel without manually typing parameters is easy to do if we read the grub info page. According
to the section entitled "configuration" all of the commands used for booting can be put in a file called
menu.lst
and placed in the
/boot/grub
directory.
Be sure to type the
menu.lst
filename correctly with a lowercase L after the dot and not a number one.
To automate system start−up we will need an init daemon. We know this because the Bootdisk−HOWTO and
From−Powerup−To−BASH−Prompt−HOWTO both make mention of init as the first program to start after
the kernel loads. The latter HOWTO also goes into some detail about the
/etc/inittab
file and the
organization of startup scripts. This could be helpful since FHS, the blueprint we have used so far, makes no
recommendation for init scripts.
We will also need to find the shutdown command to fulfill the second goal of graceful shutdown capability.
6.2.2. Obtaining source code
Searching the Linux Software Map on Ibiblio for the keyword "init" gives a large number of results. From
reading the From−Powerup−To−BASH−Prompt−HOWTO however, we know that most Linux systems use a
Chapter 6. Automating Startup & Shutdown
28