mariadb-clustercheck: Add a script handling signals

Since socat does not rewrite SIGTERM to exit 0 (see [1]) - let's fix it in a
different way.

[1]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=809633

Change-Id: If27d93c509496651f8aa5e49a7d63b24eda91a8e
This commit is contained in:
Michal Nasiadka 2024-01-08 13:01:06 +01:00
parent 9ebd51f799
commit dd3e46cd83
2 changed files with 22 additions and 1 deletions

View File

@ -6,8 +6,10 @@ LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build
{% block mariadb_clustercheck_header %}{% endblock %} {% block mariadb_clustercheck_header %}{% endblock %}
COPY extend_start.sh /usr/local/bin/kolla_extend_start COPY extend_start.sh /usr/local/bin/kolla_extend_start
COPY socat_wrapper.sh /usr/local/bin/socat_wrapper
RUN chmod 644 /usr/local/bin/kolla_extend_start RUN chmod 644 /usr/local/bin/kolla_extend_start && \
chmod 755 /usr/local/bin/socat_wrapper
{% block mariadb_clustercheck_footer %}{% endblock %} {% block mariadb_clustercheck_footer %}{% endblock %}
{% block footer %}{% endblock %} {% block footer %}{% endblock %}

View File

@ -0,0 +1,19 @@
#!/usr/bin/env bash
catch_term() {
kill -TERM "$child" 2>/dev/null
exit 0
}
catch_quit() {
kill -QUIT "$child" 2>/dev/null
exit 0
}
trap catch_term SIGTERM
trap catch_quit SIGQUIT
socat "$@" &
child=$!
wait "$child"