Too Slow To Stop
Mikkel L. Ellertson
mikkel at infinity-ltd.com
Wed Aug 8 16:46:38 UTC 2007
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!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: OpenPGP digital signature
Url : http://lists.fedoraproject.org/pipermail/users/attachments/20070808/0215f4c5/attachment-0002.bin
More information about the users
mailing list