SourceFiles.org - Use the Source, Luke
Home | Register | News | Forums | Guide | MyLinks | Bookmark

Related Sites

Latest News
  General News
  Reviews
  Press Releases
  Software
  Hardware
  Security
  Tutorials
  Off Topic


Back to files

rc handler

Copyright

rch - the rc handler - is released under the GPL version 2 or later. See file COPYING for more details.

where to get it :
http://www.franken.de/users/duffy1/rjakob/rch-0.1.tar.gz report bugs and comments to :
rjakob@duffy1.franken.de

Backup your files !
Be sure to have a rescue disk/CD !

To install it, just run
make
make install

For packaging you may want to use something like : make INSTALLROOT=/var/tmp/rch install

If there is no config file found, a template will be installed in /etc/rc.conf, a sample inittab is in the source directory.

Version 0.2, March 2000

Added some scripts for /etc/init.d

Initial release (v 0.1, Dec. 1999)

This is an attempt to make the configuration and the management of the various start scripts much easier. The starting point was the r2d2 package by Winfried Truemper. I very liked the idea of configuring the start and stop processing in one text file instead of several file names.
Unfortunately I had some problems with the script and the configuration and I urgently needed a solution. As I'm more a C programmer than a script guru, I packed the things to do in a small C program and rch was born. This is a one evening's work, so there may be some bugs. I checked the transition of run levels several times and it seems to work.

Configuration

rch is started from init to handle the starting/stopping of the services. It uses /etc/rc.conf for that where you give commands to do that. The syntax of a rc.conf line is :

rl1:rl2:how:command

where rl1 and rl2 are sets of run levels or a single run level. Legal values are : N,S,0-6 and *.
When changing to another run level, rch gets both the previous and the new run level. First rch checks for stopping processes by reading /etc/rc.conf line by line and comparing the two sets with the run levels it got from init.
A command is called with an additional "stop" parameter, if the "how" field is not once and ...
- the new run level is in the rl1 set
- or the new run level is 0 or 6
(so that you do not have to put a 06 in each line for specifying what to stop on halt/reboot)
- and the previous run level is in the rl2 set

an asterisk (*) matches all run levels so that all things are stopped that are started for the previous level and should go down in the current run level.

Next the file is parsed for starting services. All lines match where the previous run level is in rl1 and the current is in rl2.

Found stop and start commands are saved in tables, the sorting for stopping is reversed and finally the commands are run through /bin/sh. The PATH is set to /sbin:/bin:/usr/sbin:/usr/bin.

Rolf


Other Sites

Discussion Groups
  Beginners
  Distributions
  Networking / Security
  Software
  PDAs

About | FAQ | Privacy | Awards | Contact
Comments to the webmaster are welcome.
Copyright 2006 Sourcefiles.org All rights reserved.