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

Re: What file to add command to start at bootime

On Monday 04 July 2005 03:42, Cao Van Khanh wrote:
> I have some script and would like to run it at boot
> time . I could not find how to do that in debian . In
> redhat I could add to /etc/rc.d . How to make it in
> debian ?
> Thank for reading

Under debian the rc?.d directories are split out by 
runlevel. Runlevel 0 is shut-down, runlevel 1 is single 
user and runlevels 2-5 can be used for normal setups. 
Debian at installation appears to put everything else 
at runlevel 2 and shoot for a runlevel 2 once up and 
running. SuSE certainly used to spread things out much 
more amongst the runlevels at installation out of the 
box; haven't looked at it for a few years so I don't 
know if it still does.

Anyway, if you have a fairly vanilla setup and you want 
this always to run at boot, I suggest you put the 
script in rc2.d and name it S<number><scriptname>. The 
number affects the order it gets run in. I _think_ the 
number has to be 2 digits. 

If your script starts a service of some kind, then you 
should but a script to shut it down, following the 
convention K<number><scriptname>, in either / both of 
rc0.d and rc1.d (rc1.d if this service should not run 
in single user mode).

The number after the K again sets the order; services 
should as far as practical be stopped in the reverse 
order they are started in.

Hope that helps.


Reply to: