Re: Too Slow To Stop

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Mike - EMAIL IGNORED wrote:
> 
> #
> #  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}"
You may want to change this to reflect that you do not implement
reload and status.

     echo "Usage: $DAEMON start|stop|restart|condrestart}"

>    exit 1
> esac
> 
with a couple of minor changes, the script looks fine. The problem
may be that your proc does not respond to a SIGTERM, so it is not
killed until the killproc function sends a SIGKILL. If this is the
case, then you may want to change "killproc $proc_prog" to
"killproc $proc_prog SIGKILL" so that it sends the kill signal right
away. A better fix would be if the process would respond to a
SIGTERM by doing a proper shutdown. Does your program trap SIGTERM
and do anything with it? (Or trap and ignore it?)

Mikkel
-- 

  Do not meddle in the affairs of dragons,
for thou art crunchy and taste good with Ketchup!

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux