Support --defaults-group-suffix option in systemd unit file

Related: #1400702
This commit is contained in:
Honza Horak 2017-08-28 17:07:05 +02:00
parent 84ceb88ce7
commit 7df1bd6b07
3 changed files with 17 additions and 6 deletions

View File

@ -962,6 +962,8 @@ fi
%changelog
* Mon Aug 28 2017 Honza Horak <hhorak@redhat.com> - 5.7.19-6
- Add bundled(boost) virtual provide
- Support --defaults-group-suffix option in systemd unit file
Related: #1400702
* Fri Aug 04 2017 Honza Horak <hhorak@redhat.com> - 5.7.19-5
- Allow to use MD5 in FIPS mode

View File

@ -18,13 +18,23 @@ get_mysql_option(){
sections="$1"
option_name="$2"
default_value="$3"
result=`@bindir@/my_print_defaults $sections | sed -n "s/^--${option_name}=//p" | tail -n 1`
result=`@bindir@/my_print_defaults $my_print_defaults_extra_args $sections | sed -n "s/^--${option_name}=//p" | tail -n 1`
if [ -z "$result" ]; then
# not found, use default
result="${default_value}"
fi
}
# For the case of running more instances via systemd, scrits that source
# this file can get --default-group-suffix or similar option as the first
# argument. The utility my_print_defaults needs to use it as well, so the
# scripts sourcing this file work with the same options as the daemon.
my_print_defaults_extra_args=''
while echo "$1" | grep -q '^--defaults' ; do
my_print_defaults_extra_args="${my_print_defaults_extra_args} $1"
shift
done
# Defaults here had better match what mysqld_safe will default to
# The option values are generally defined on three important places
# on the default installation:

View File

@ -34,15 +34,14 @@ After=network.target
Type=forking
User=mysql
Group=mysql
PIDFile=@PID_FILE_DIR@/@DAEMON_NO_PREFIX@.pid
ExecStartPre=@libexecdir@/mysql-check-socket
ExecStartPre=@libexecdir@/mysql-prepare-db-dir %n
ExecStartPre=@libexecdir@/mysql-check-socket --defaults-group-suffix=.%I
ExecStartPre=@libexecdir@/mysql-prepare-db-dir --defaults-group-suffix=.%I %n
# Note: we set --basedir to prevent probes that might trigger SELinux alarms,
# per bug #547485
ExecStart=@libexecdir@/mysqld --defaults-group-suffix=.%I --daemonize --basedir=@prefix@ --pid-file=@PID_FILE_DIR@/@DAEMON_NO_PREFIX@.pid
ExecStartPost=@libexecdir@/mysql-check-upgrade
ExecStopPost=@libexecdir@/mysql-wait-stop
ExecStartPost=@libexecdir@/mysql-check-upgrade --defaults-group-suffix=.%I
ExecStopPost=@libexecdir@/mysql-wait-stop --defaults-group-suffix=.%I
# Give a reasonable amount of time for the server to start up/shut down
TimeoutSec=300