adjust rc_reload/rc_stop handling so that if a master process is running

and conserver is in the (default) "setproctitle" mode, it only attempts to
signal the master and not any other processes. avoids delays during
shutdown/restart and dangling processes which have been observed when
multiple processes are running (presumably due to the childs being
signalled before the master takes them down more cleanly).
This commit is contained in:
sthen 2019-01-25 11:35:54 +00:00
parent 4942c12009
commit e13d73575c
2 changed files with 21 additions and 3 deletions

View File

@ -1,9 +1,9 @@
# $OpenBSD: Makefile,v 1.63 2018/09/04 12:46:09 espie Exp $
# $OpenBSD: Makefile,v 1.64 2019/01/25 11:35:54 sthen Exp $
COMMENT= manage remote serial consoles via TCP/IP
V= 8.2.2
REVISION= 1
REVISION= 2
DISTNAME= conserver-$V
CATEGORIES= comms

View File

@ -1,6 +1,6 @@
#!/bin/ksh
#
# $OpenBSD: conserver.rc,v 1.10 2018/06/01 17:06:21 sthen Exp $
# $OpenBSD: conserver.rc,v 1.11 2019/01/25 11:35:54 sthen Exp $
daemon="${TRUEPREFIX}/sbin/conserver -d"
daemon_flags="-n"
@ -16,4 +16,22 @@ rc_pre() {
-m 644 /dev/null /var/log/conserver
}
rc_reload() {
if pgrep -T "${daemon_rtable}" -q -xf 'conserver: master.*'; then
pkill -HUP -T "${daemon_rtable}" -xf 'conserver: master.*'
else
pkill -HUP -T "${daemon_rtable}" -xf \
"(${daemon}${daemon_flags:+ ${daemon_flags}}|conserver: .*)"
fi
}
rc_stop() {
if pgrep -T "${daemon_rtable}" -q -xf 'conserver: master.*'; then
pkill -T "${daemon_rtable}" -xf 'conserver: master.*'
else
pkill -T "${daemon_rtable}" -xf \
"(${daemon}${daemon_flags:+ ${daemon_flags}}|conserver: .*)"
fi
}
rc_cmd $1