Too Slow To Stop

Mike - EMAIL IGNORED m_d_berger_1900 at yahoo.com
Wed Aug 8 15:21:27 UTC 2007


On Tue, 07 Aug 2007 17:11:11 -0500, Mikkel L. Ellertson wrote:

[...]

> The run lever is the run lever you boot in. You are starting in run
> level 3. When you run startx, you start the X server, but you do not
> change the run level. With run level 5, you get a GUI login on VT7,
> as well as the CLI logins on VT1 through VT76. (By default - this is
> configurable.) The use of run level 5 for GUI logins, and run level
> 3 for CLI logins in an accepted convention, but it can be changed.
> If you are interested, you can run "man init" for a better
> description of runlevels.
> 
> From your questions, I suspect that you do not really understand how
> the init scripts and run levels work. So I suspect that your problem
> is that your script in not sending a kill signal to your process, so
> it is not killed until the cleanup the kills all running processes.
> You should probably read the documentation I pointed you to, or post
> your init script and let us try and fix it. At this point, we do not
> have enough information to properly solve your problem. I think you
> have a more basic problem then when the init script is run with the
> stop command.
> 
> Mikkel
[...]

You are correct that my understanding of init scripts is thin. I
have included the script in question below.  You see that my script
uses the killproc subscript in /etc/init.d/function, which I am
guessing, sends the correct signals.  I think the real problem is
that this process needs to be killed quickly, perhaps more so than
usual.  The best solution I can see would be to add a system call to
my process with which it could ask whether the system is in the middle
of a shutdown.  As yet, I have not found this.

Thanks for your help.
Mike.

#
#  08/07/07
#
# chkconfig: 35 90 1
# description: controls proc daemons
#
# Source function library.
. /etc/init.d/functions

proc_prog=proc

VAR_SUBSYS_PROC=/var/lock/subsys/$proc_prog

if [ ! -x /usr/sbin/$proc_prog ]; then
    echo -n $"/usr/sbin/$proc_prog does not exist."; failure; echo
    exit -1
fi

case $1 in
   start)
      if test -e $VAR_SUBSYS_PROC; then
         echo_failure
         echo
      else
         touch $VAR_SUBSYS_PROC
         echo -n "Starting $proc_prog: "
         OPTIONS="--daemon"
         daemon --user=root /usr/sbin/$proc_prog $OPTIONS
         echo
      fi
   ;;
   stop)
      echo -n "Stopping $proc_prog: "
      killproc $proc_prog
      echo
      rm -f $VAR_SUBSYS_PROC
   ;;
   restart)
      echo $0
      $0 stop
      sleep 2
      $0 start
   ;;
   condrestart)
      if test -e $VAR_SUBSYS_PROC; then
         $0 stop
         # avoid race
         sleep 2
         $0 start
      else
         echo -n Conditional Restart $proc_prog: not running
         success; echo
     fi
   ;;
#  reload)
#  ;;
#  status)
#  ;;
   *)

   echo "Usage: $DAEMON {start|stop|restart|condrestart|reload|status}"
   exit 1
esac






More information about the users mailing list