security/munge: Fix rc script
The problem is that the munged_stop() function does not wait until the kill completes. This can cause start to fail with "munged already running" when the system is heavily loaded and kill is slower than usual. PR: 277003
This commit is contained in:
parent
02bc47fa20
commit
935bde5ee1
|
@ -1,6 +1,6 @@
|
|||
PORTNAME= munge
|
||||
DISTVERSION= 0.5.15
|
||||
PORTREVISION= 1
|
||||
PORTREVISION= 2
|
||||
CATEGORIES= security
|
||||
MASTER_SITES= https://github.com/dun/${PORTNAME}/releases/download/${PORTNAME}-${DISTVERSION}/
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
# Add the following line to /etc/rc.conf to enable munged:
|
||||
# munged_enable (bool): Set to "NO" by default.
|
||||
# Set it to "YES" to enable munged.
|
||||
# munged_keyfile (str): Set to "/usr/local/etc/munge/munge.key" by default.
|
||||
# munged_keyfile (str): Set to "%%PREFIX%%/etc/munge/munge.key" by default.
|
||||
# Custom munge key.
|
||||
# munged_pidfile (str): Set to "/var/run/munged.pid" by default.
|
||||
# Custom PID file path and name.
|
||||
|
@ -31,10 +31,23 @@ command_args="--key-file=${munged_keyfile}"
|
|||
|
||||
munged_stop()
|
||||
{
|
||||
if [ -f "${pidfile}" ]; then
|
||||
kill `cat ${pidfile}`
|
||||
if checkyesno $rcvar; then
|
||||
echo "Stopping $name."
|
||||
pids="$(pgrep -d ' ' $name)"
|
||||
if [ -n "$pids" ]; then
|
||||
echo "Waiting for PIDs: $pids"
|
||||
for signal in TERM INT QUIT KILL
|
||||
do
|
||||
kill -s $signal $pids
|
||||
sleep 1
|
||||
pids=$(pgrep -d ' ' $name)
|
||||
if [ -z "$pids" ]; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
rm -f $pidfile
|
||||
fi
|
||||
}
|
||||
|
||||
run_rc_command "$1"
|
||||
|
|
Loading…
Reference in New Issue