[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: prog. end of the boot ? rc.local



Debian uses the /etc/rc0.d -> /etc/rc6.d folders for links to actual
scripts in /etc/init.d.  When the boot process reaches a particular run
level (say level 2), it processes all the links in the /etc/rc2.d 
directory, in order.  If the link starts with a K then it executes the
link with the stop parameter (meaning it runs the same scripts in ../init.d
with stop).  If the link starts with an S then it sends the option start.
If you look at the actual scripts in /etc/init.d you can see that they
use case logic based on the option passed to decide whether to start
or stop daemons.  In general, rc0.d, rc1.d and rc6.d contain largely K
links because these are the run levels for shutting down the system or
rebooting it.  rc2 - rc5 are the run levels where stuff gets started.

So, to answer your question, the way I stop the crap from running is
to either uninstall the package, or simply change the name of each link
so that it starts with DISABLE instead of K or S.  When the system is
booting, or shutting down, it ignores all links that don't start with K
or S, so this effectively disables the daemon without removing the
script or the binary in case you want to run it later.  You'll have to
either figure out what your run levels are, or just move all the links
in the directories rc0 - rc6.

To start a new service, or do something that you would have done in
rc.local in RedHat, write a script that knows about start and stop,
put it into /etc/init.d, and then link it with a K or and S in all
the rc directories.  You can decide where your script will run by
choosing the number appropriately.  (i.e. if you compiled Apache
yourself and want it to run, you should probably make the script link
such that it starts after your network initialization scripts or
it might hang.  If you look at the way the rc directories are ordered,
you'll see what I mean.

There is one last directory named /etc/rc.boot that has a couple scripts
in it that run when the system first comes up.  I've never messed with
it, but it's there for the fooling with.

Hope this helps.

Chris
-- 
+--------------------------------+----------------------------------+
| Christopher S. Swingley        | 108 O'Neill Building --    x7092 |
| Programmer / Analyst           | 940 Sheep Creek Rd   -- 479-9729 |
| IARC - Frontier                | cswingle@iarc.uaf.edu  (email)   |
| University of Alaska Fairbanks | www.frontier.iarc.uaf.edu:8080/  |
| Fairbanks, AK  99775           |            ~cswingle   (web)     |
+--------------------------------+----------------------------------+

Quoting Attila Csosz <acsosz@mail.datanet.hu>:
> I'd like to start a program at the end of the boot, where to should I put
> it? ( under redhat was rc.local )
> Where could I study the debian boot sequence? ( doc, links? )
> 
> How could I eliminate squid and apache daemons? ( they are started at boot )
> 
> Thanks
>  Attila
> 
> Debian 2.1/2.0.36
> 
> 
> 
> 
> 
> 
> 
> -- 
> Unsubscribe?  mail -s unsubscribe debian-user-request@lists.debian.org < /dev/null
> 


Reply to: