Starting applications at boot
Alex Mauer
hawke at hawkesnest.net
Tue Jun 5 20:26:47 UTC 2007
Jan Sneep wrote:
> Interesting information about how the system starts and kills the various
> scripts.
>
> But it doesn't say how to add a script to rc2.d for example. Does one just
> arbitrarily pick a number to go before a copy of the script?
More or less. The scripts are run in numerical/alphabetical order; so
if your service needs to run before or after another service, you can
pick an appropriate number. It is perfectly valid/safe to use the same
number twice.
The normal way of adding a script is to add it to /etc/init.d named
after the service itself, and then make a symlink at rc?.d pointing to
it. Scripts beginning with 'S' will be run with the parameter 'start'
while those beginning with 'K' will be run with the parameter 'stop'.
The system is case-sensitive.
> I can understand starting at level S and then moving to Level 1 and then
> Level 2 for a server, but what triggers the system to move to level 3,4, & 5
> ... level 6 is shutdown right?
yes, 6 is shutdown; other than that, the runlevels aren't really a
progression. The system starts at runlevel 'S' and from there proceeds
to whatever is specified by the initdefault option in /etc/inittab, or
level 2 if there is no inittab. (The default runlevel is determined by
/etc/event.d/rc-default)
level 3-5 (and really, 6 could be redefined to do something other than
reboot) are triggered by 'telinit', or 'init', manually. In an
upstart-based system, they do nothing; in a traditional system they do
things like mount network filesystems or start X, in addition to
everything that level 2 does.
HTH
-Alex Mauer "hawke"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20070605/35bfb072/attachment.sig>
More information about the ubuntu-users
mailing list