[Ilugc] rc.local

  • From: sriram@xxxxxxxxxxxxxxxxxx (P. Sriram)
  • Date: Mon, 2 Sep 2002 10:17:16 +0530 (IST)

On 29 Aug 2002, Gaurang Pandya wrote:

Does rc.local get executed autometically after rc.sysinint or I 
have to call it from rc.sysinit?

using the standard sysv style, rc.local is usually run last automatically 
- but it depends. for example, rc.local is usually not run for runlevel 1 
(single user mode). to see what your distribution does, look in the 
appropriate directory (/etc/rc.d/rcx.d where x is the run level). you do 
not (normally) want to start rc.local from rc.sysinit. rc.sysinit is 
intended to be run once on bootup. rc.local is intended to be run last 
after everything else is done, usually once per run level change 
(including once after bootup after entering appropriate run level). the 
following can be thought of as what happens.

(1) at boot up, rc.sysinit is run once

(2) next, rc (actually /etc/rc.d/rc) is called with the appropriate run
level, say m as the argument

(3) rc looks in /etc/rc.d/rcm.d, runs all the Knn files in numerical order
with stop as the argument and then runs all the Snn files in numerical
order with start as the argument

for a run level change (init m command), we start with step (2).

for the appropriate run levels (3 and 5), rc.local is run last by having a 
link S99local in the /etc/rc.d/rc3.d and /etc/rc.d/rc5.d directories (both 
links, of course, pointing to /etc/rc.d/rc.local).

xtra info: so, if you want to write your own nifty sysv init script for 
your own application, it is not too hard. just write a script that will 
take stop or start as an argument to stop/start the application. then, 
put this script in /etc/rc.d/init.d. then, create symbolic links to this 
script at appropriate places in the rcx.d directories. the Kmm link will 
be used to stop the application and the Snn link will be used to start 
the application. mm and nn can be set so your application will be stopped 
and started gracefully in the right place in the sequence.

sriram




Other related posts:

  • » [Ilugc] rc.local - P. Sriram