Marko Kreen <marko@l-t.ee> writes: > On Wed, Aug 08, 2001 at 02:56:46PM -0700, Mike Fedyk wrote: > > On Wed, Aug 08, 2001 at 08:44:50PM +0200, Marko Kreen wrote: > > > On Wed, Jul 25, 2001 at 11:05:25AM -0700, Dale Southard wrote: > > > > Why not use something like the IRIX ``chkconfig'' system: Provide a > > > > simple program that takes the ``name'' of a service and then checks an > > > > external file/files for ``on'' or off status of each service, and > > > > returns 0 if on, 1 if off. Then have each init.d script do something > > > > like: > > > > > > > > case "$1" in > > > > 'start') > > > > if /etc/chkconfig myservice; then > > > > ... > > > > start myservice > > > > ... > > > > fi > > > > > > Would not it be better to put this login in rcS script? That > > > way the services can be manually started if needed (eg. for > > > testing). > > > > > > > If you want to login before services start in single user mode then change: > > Uh. Ofcourse I meant 'code'. I have no idea how the word > 'login' got there... > > Dale proposed that each init script checks itself whether it > needs to be started, from some central location.
Actually, it is how SGI's IRIX works -- so it's not really my idea, only something that I've seen work in practice and seems trivial to implement. > I think this > is not good, it takes away flexibility. IMHO it would be better > if only /etc/init.d/rc (& rcS) checks whether a service should be > auto-started on boot. That way the responsibility is also > divided better, init-script's business is to start a service > and rc/rcS business is start boot-time services. Interesting idea. It certainly simplifies the implementation, but it actually reduces the flexibility, rather than adds to it. If the ``do I run service X'' check is done in rcS it means that each init.d script is either on or off. This would eliminate the possibility of having more than one check in a script -- for example, it would be logical to configure the existing Debian networking script with chkconfig options for spoofprotect, syncookies, and ip_forward. This wouldn't be possible if the chkconfig is done in rcS. IRIX actually leverages this significantly -- there are a dozen or so different chkconfig controls in the IRIX networking script used to enable/disable starting of things like nfs, autofs, timed, gated, etc. > One easy hack woud be to replace '-f' with '-x' in following > code in rc, rcS: > > [ ! -f "$i" ] && continue > > then later you can 'chmod -x' init scripts. Problem with > this is that on upgrade your 'settings' will be lost. Exactly the problem we were discussing. The advantage of the IRIX chkconfig system is that it puts the ``on or off'' information for each service in a directory that isn't clobbered by upgrades. The above replacement wouldn't likely survive upgrades. -- /* Dale Southard Jr. [EMAIL PROTECTED] 925-422-1463, fax 422-9429 */ /* Computer Scientist, Accelerated Strategic Computing Initiative */ /* L-073, Lawrence Livermore National Lab, Livermore CA 94551 */ /* AFF/I, SL/I, T/I, D-11216, Sr. Rig --- I'd rather be skydiving */