that patch is still wrong.
The first time a HUP is received, we run the code in the trap and call wait which will wait for both the refresh command and the mysqld one.
But we won't return from that trap until mysqld dies, and in the trap the HUP signal is blocked, which means any subsequent HUP will not be handled.
A better way could be to implement some proper event handling as in:
trap : HUP INT QUIT TERM while :; do action= mysqld ... & while :; do signal=NONE wait || signal=$(kill -l "$?")
case $signal in (INT|TERM|QUIT) mysqladmin ... shutdown; exit;; (HUP) mysqladmin ... refresh;; (NONE) break;; # mysqld died (*) unexpected ... die;; esac esac done
that patch is still wrong.
The first time a HUP is received, we run the code in the trap
and call wait which will wait for both the refresh command and
the mysqld one.
But we won't return from that trap until mysqld dies, and in the
trap the HUP signal is blocked, which means any subsequent
HUP will not be handled.
A better way could be to implement some proper event handling as in:
trap : HUP INT QUIT TERM
while :; do
action=
mysqld ... &
while :; do
signal=NONE
wait || signal=$(kill -l "$?")
case $signal in INT|TERM| QUIT) mysqladmin ... shutdown; exit;;
(
(HUP) mysqladmin ... refresh;;
(NONE) break;; # mysqld died
(*) unexpected ... die;;
esac
esac
done