[CentOS] # chkconfig: kill at run level 3

Mon Dec 6 18:48:11 UTC 2010
Michael D. Berger <m_d_berger_1900 at yahoo.com>

On Mon, 06 Dec 2010 01:30:12 -0500, Nico Kadel-Garcia wrote:

> On Sun, Dec 5, 2010 at 10:46 PM, Michael D. Berger
> <m_d_berger_1900 at yahoo.com> wrote:
>> On Sun, 05 Dec 2010 10:50:53 -0500, Robert Spangler wrote:
>>
>>> On Friday 03 December 2010 19:30, Michael D. Berger wrote:
>>>
>> [...]
>>>
>>> Check /etc/rc.d/rc6.d and insure that you have K??yourscriptname in
>>> there.  It looks like your script demon was setup to be run but was
>>> never properly setup to be shut down.  When shutting down the system
>>> the system is switched to run level 6.
>>
>> The correct K link does appear in /etc/rc.d/rc6.d .  I wrote a "stop"
>> script that stops my daemon, does sleep 5, and then calls shutdown (or
>> reboot).  I don't like this kluge, but it does work.  Could it be that
>> my daemon stop procedure is too slow or complex for shutdown?  The TERM
>> code does send stop messages to and join several threads, which in turn
>> do the same to nested threads. Each thread does some stop logging,
>> among other things.
>>
>> Mike.
> 
> "Taking too long" is unlikely. Running through the shutdown init scripts
> is normally a serial operation, not a parallel one.
> 
> It could be that your shutdown script is simply incomplete, and fails to
> *finish* stopping a process before proceeding to the next one. If you
> wait on each threed to stop, surveying it for status and killing it whan
> an ax only if necessary, then you may have a better fighting chance of
> getting it shut down gracefully.
> 
> I've had some recent work with init scripts that weren't written as init
> scripts, that get confused and hang ridiculously awaiting further input.
> Issuing yet another "shutdown" or "reboot" command at that point will
> simply re-run your shutdown procedures, especially this shutdown script:
> that way can lie madness if your "threads" aren't shut down gracefully.
> 
> It sounds like you need more thorough logging of what your shutdown
> script does.....

I think that I am missing something.  In my script in /etc/init.d :

   stop)
      echo -n "Stopping $myThing: "
      killproc -d 5 $myThing_prog
      sleep 30
      echo
      rm -f $VAR_SUBSYS_MYTHING
   ;;

The sleep 30 is not usually there, but it didn't make any difference.
There certainly was not a 30 second delay in the shutdown sequence.

I also put a sleep(30) in the TERM signal processor and there was
no difference. (BTW, the daemon is in C++.)

When you say the shutdown runs through the scripts sequentially,
then why didn't my sleeps work?  When I call the stop for my daemon
without shutting down, there is no problem.

BTW, it is K03 ...

Thanks,
Mike.