Recently noticied that on my 486/100 box (not very slow --
it was very fast some years ago, but not for now) some startup
scripts are not executed (executed, but services not started).
After some investigations I found this:

 $ /etc/rc.d/init.d/named start
 Starting named:
 $ _

But (^ markers are mine):
 $ sh /etc/rc.d/init.d/named start
   ^^
 Starting named:         [ OK ]
                         ^^^^^^
 $ _

After some more investigations, I found the cause of the problem:
>From /etc/.../named, function daemon is called, that, before other
work, checks if process with given name already started.  Relevant
lines from /etc/rc.d/init.d/functions (daemon) looks like (just an
example, not a real lines):

   ...
   if [ -n "`pidof $proc`" ] ; then
     exit 0
   fi
   ..

And here is something like pstree for this:

  1234  /etc/rc.d/init.d/named start      -- main rc script; note it's name
    1251 /etc/rc.d/init.d/named -- forked `pidof ...`; also note name
      inside 1251, if I do "ps -C named", I get two pids,
      namely 1234 and 1251; hence pidof returns those (actually
      three, as there is another fork by sh)

If I execute that as "sh ...", 1234 process will be named "sh", not
"named", so pidof returns nothing.

So far, so good -- this is definitely a bug in initscripts.
But -- why this does not happen on faster machines!?
I have some more machines here, all at least Pentium/133
(and PII/500 and others), but with this, all is ok.
So the question is -- why on faster machine pidof returns nothing!?
Maybe it openes /proc for scan before it is "updated" to reflect
creation of new process, and even for top one?!  Looks like it is
also a bug in kernel...

For completness: tried with all kernels shipped by redhat since
6.0 release (2.2.5..2.2.14), compiled for 386 or 486.
All of this gives me the same results on my 486 box -- most
of services won't start.  Also tried many kernels on faster machines,
and even tried 386 versions on those -- all looks "good", i.e.
pidof (seemed) returns nothing.

Also very interesting point here is that when those scripts executed
by rc on startup, about 99% of services started.  But when I start them
by hand, executing "/etc/.../service start" from command prompt,
100% of them are _not_ started.  Only by prefixing by "sh ".

Any ideas?

Regards,
  Michael.

-- 
To unsubscribe:
mail -s unsubscribe [EMAIL PROTECTED] < /dev/null

Reply via email to