<= back to main index

rc.mobile - configurable startup for mobile hosts

Last modified: Nov 28 21:47


rc.mobile this is a startup script mostly aimed at mobile machines which are booted in different places. It takes a simple config file that specifies the services desired and any config files to customise. Typical use prompts for the current location early in the boot sequence.

Also see the manual: rc.mobile.1.html.

It runs startup scripts in parallel which results in significantly faster bootup than the usual sequential startup and has facilities for waiting for prerequisite services where timimg dependencies do exist.

Because it runs the startup files as shipped from your vendor, setup requires very little customisation of your system.

Example configuration file

As examples, here is the /etc/rc.mobile.conf file for my RedHat 9 laptop ``newt'': rc.mobile.conf-newt, and for my Fedora Core 2 laptop ``kirsty'': rc.mobile.conf-kirsty. Even on newt, with its 233MHz processor, slow disc and 96MB of RAM, startup is much faster than the normal sequential startup of standard machines.


Installation is as follows:

Make the file /etc/rc.mobile.conf,
Use the example [newt-rc.mobile.conf] as a template.

Make sure /opt/css/bin is available after /etc/rc.sysinit has run.
If /opt/css is part of the root filesystem you'll be fine. On RedHat systems you should also be fine because the local filesystems are mounted by /etc/rc.sysinit.

Run rc.mobile from /etc/rc.local
Add the line:
        /opt/css/bin/rc.mobile start

to the /etc/rc.local file.

Note: the script prompts for you current location, offering a choice of all the rc.mobile.conf clauses whose names start with an @. The default clause name comes from from the environment variable $SYSTEMID, falling back to ``home'' if this is not set. So if you are usually elsewhere you may want to make the invocation:

        SYSTEMID=where /opt/css/bin/rc.mobile start

setting where to the name of the location clause you would usually use (without the leading ``@'').

Disable most startup services
Because rc.mobile will be starting these according to your instructions in the /etc/rc.mobile.conf file the normal service startups should be disabled.

For a RedHat system walk through the startup services listed by:

        chkconfig --list | grep :on

making sure that (a) you want them and (b) they're named in the rc.mobile.conf file in the appropriate clauses. Of course in some locations you will want different services.

For each such service (except for keytable), add it to the config file and turn it off in the default startup:

        chkconfig --level 2345 service off

where service is the service to disable.

When you're finished the chkconfig(8) command should look nice and spartan:

        [~]@newt*> chkconfig --list | grep :on
        keytable        0:off   1:on    2:off   3:off   4:off   5:off   6:off

Isn't that nice!

I left keytable in there for two reasons. Firstly it seemed one of basics needed to make your console sane. And secondly when I was testing rc.mobile on an ``up'' laptop with an X11 desktop running it totally trashed the keyboard mapping. Had to power cycle!

There are five types of lines in the config file:

This copies the file /path/to/file.where to the named file.

This copies the directory /path/to/dir.where to the named directory using rsync(1).

use clause>
Run the named clause.

svc service...
Dispatch the named services in parallel. Don't wait for them. This is done by running the command:
      /etc/init.d/service start

Note: service names must be valid shell identifiers (letters, underscores and digits). If some startup file is not named like that, make a suitably named symlink to it and use that.

need service...
Wait for the named services to start up before proceeding. If they haven't been dispatched already, dispatch them as with svc.

! shcmd
Run the shell command shcmd. Wait for it to finish. Naturally, put an ``&'' on the end if you don't want to wait.