LinuxSA Mailing list archives

Index: [thread] [date] [subject] [author]
  From: behoffski <behoffski@grouse.com.au>
  To  : Prashanth N V , linuxsa@linuxsa.org.au
  Date: Sun, 16 May 1999 15:47:41 +0930

Re:

Prashanth N V wrote:
> I want to run a file (demon)all ways when ever my linux reboots ,now i
> have to run manully the file if a machine reboots .
> so can you let me know is there any way how i can make a particular file
> run every time the machine boots or reboots.

I'm not an expert at Linux, so the following is guesswork:

The system starts from init -- try "man init" for a long 
explanation on how Init works.  In Red Hat Linux (the only 
variant I'm familiar with), the init file /etc/inittab works 
through a tree of files that divide the bootstrap into various 
phases (runlevels) -- with more capabilities appearing at 
the end of each level.  

The files are in /etc/rd.c, with individual scripts in 
subdirectories.  Scripts are either Kill scripts or 
Start scripts -- scripts have filenames starting with K or S.  
Next a two-digit number allows some specification of order 
of execution -- 00 to 99.  Finally the remainder of the 
script helps describe what is being started or stopped.  
So you've got lots of control over what happens when 
while starting or stopping.  It's easy to add or subtract 
components merely by adding, removing or renaming files.  
Order of execution within a level is trivial to change 
merely by changing the two-digit number.  You can modify 
the bootstrap and shutdown without having to modify your 
or anybody else's script(s).  

For example, the line printer daemon (lpd) is started 
when you enter runlevel 2: 

	/etc/rc.d/rc2.d/S60lpd

and the daemon is stopped when the "shutdown" runlevel 6 
is entered:

	/etc/rc.d/rc6.d/K60lpd

Exactly where you add your script(s) depends on how much 
of the overall capabilities of the machine need to available.  
For example, most of the networking facilities, such as 
NFS, come up in runlevel 3.  

I'm rather hazy on the finer details of this stuff -- I'm 
more of a coder than a Linux administrator.  There may be 
gross errors in my explanation above.  Would one of the 
real gurus out there like to explain things properly?  
(Or point to the relevant HOWTO, or whatever.)  

behoffski

-- 
behoffski (Brenton Hoff) | Software Engineer, Grouse Software
behoffski@grouse.com.au  | http://www.grouse.com.au/

-- 
Check out the LinuxSA web pages at http://www.linuxsa.org.au/
To unsubscribe from the LinuxSA list:
  mail linuxsa-request@linuxsa.org.au with "unsubscribe" as the subject


Index: [thread] [date] [subject] [author]
Return to the LinuxSA Mailing List Information Page