diff options
author | Christian Hesse <mail@eworm.de> | 2017-01-05 12:07:26 +0100 |
---|---|---|
committer | Vicențiu-Marian Ciorbaru <cvicentiu@gmail.com> | 2017-03-07 15:02:37 +0200 |
commit | ea31755760537723ded855794c16dd31c3db08c6 (patch) | |
tree | 479228e341a6cb29134881f98ad5eb4b47d8ccc9 | |
parent | dbd1d7ea8e96a2b4cff89ec889494700d634b3a3 (diff) | |
download | mariadb-git-ea31755760537723ded855794c16dd31c3db08c6.tar.gz |
properly set paths in systemd unit files
Use variables in systemd unit file templetes to properly set paths in
final systemd unit files.
-rw-r--r-- | support-files/CMakeLists.txt | 2 | ||||
-rw-r--r-- | support-files/mariadb.service.in | 10 | ||||
-rw-r--r-- | support-files/mariadb@.service.in | 20 |
3 files changed, 17 insertions, 15 deletions
diff --git a/support-files/CMakeLists.txt b/support-files/CMakeLists.txt index c80de04d069..c9addecafa5 100644 --- a/support-files/CMakeLists.txt +++ b/support-files/CMakeLists.txt @@ -90,6 +90,8 @@ IF(UNIX) SET(scriptdir ${INSTALL_SCRIPTDIRABS}) SET(libexecdir ${INSTALL_SBINDIRABS}) SET(pkgdatadir ${INSTALL_MYSQLSHAREDIRABS}) + SET(sysconfdir ${INSTALL_SYSCONFDIR}) + SET(sysconf2dir ${INSTALL_SYSCONF2DIR}) CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysql.server.sh ${CMAKE_CURRENT_BINARY_DIR}/mysql.server @ONLY) INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/mysql.server diff --git a/support-files/mariadb.service.in b/support-files/mariadb.service.in index 473f2699866..6a307b2c41f 100644 --- a/support-files/mariadb.service.in +++ b/support-files/mariadb.service.in @@ -67,19 +67,19 @@ PermissionsStartOnly=true # It is always safe to unset _WSREP_START_POSITION environment variable. # Do not panic if galera_recovery script is not available. (MDEV-10538) ExecStartPre=/bin/sh -c "systemctl unset-environment _WSREP_START_POSITION" -ExecStartPre=/bin/sh -c "[ ! -e /usr/bin/galera_recovery ] && VAR= || \ - VAR=`/usr/bin/galera_recovery`; [ $? -eq 0 ] \ +ExecStartPre=/bin/sh -c "[ ! -e @bindir@/galera_recovery ] && VAR= || \ + VAR=`@bindir@/galera_recovery`; [ $? -eq 0 ] \ && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1" # Needed to create system tables etc. -# ExecStartPre=/usr/bin/mysql_install_db -u mysql +# ExecStartPre=@scriptdir@/mysql_install_db -u mysql # Start main service # MYSQLD_OPTS here is for users to set in /etc/systemd/system/mariadb.service.d/MY_SPECIAL.conf # Use the [service] section and Environment="MYSQLD_OPTS=...". # This isn't a replacement for my.cnf. # _WSREP_NEW_CLUSTER is for the exclusive use of the script galera_new_cluster -ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION +ExecStart=@sbindir@/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION @SYSTEMD_EXECSTARTPOST@ # Unset _WSREP_START_POSITION environment variable. @@ -145,7 +145,7 @@ LimitNOFILE=16364 # ExecStartPre=sysctl -q -w vm.drop_caches=3 # numa-interleave=1 equalivant -# Change ExecStart=numactl --interleave=all /usr/sbin/mysqld...... +# Change ExecStart=numactl --interleave=all @sbindir@/mysqld...... # crash-script equalivent # FailureAction= diff --git a/support-files/mariadb@.service.in b/support-files/mariadb@.service.in index 1041933e3ec..410e7433b2b 100644 --- a/support-files/mariadb@.service.in +++ b/support-files/mariadb@.service.in @@ -1,7 +1,7 @@ # Multi instance version of mariadb. For if you run multiple versions at once. # Also used for mariadb@bootstrap to bootstrap Galera. # -# create config file @INSTALL_SYSCONF2DIR@/my{instancename}.cnf +# create config file @sysconf2dir@/my{instancename}.cnf # # start as systemctl start mariadb@{instancename}.server @@ -22,7 +22,7 @@ Description=MariaDB database server After=network.target After=syslog.target -ConditionPathExists=@INSTALL_SYSCONF2DIR@/my%I.cnf +ConditionPathExists=@sysconf2dir@/my%I.cnf [Install] WantedBy=multi-user.target @@ -73,19 +73,19 @@ PermissionsStartOnly=true # Do not panic if galera_recovery script is not available. (MDEV-10538) ExecStartPre=/bin/sh -c "systemctl unset-environment _WSREP_START_POSITION%I" -ExecStartPre=/bin/sh -c "[ ! -e /usr/bin/galera_recovery ] && VAR= || \ - VAR=`/usr/bin/galera_recovery --defaults-file=@INSTALL_SYSCONF2DIR@/my%I.cnf`; [ $? -eq 0 ] \ +ExecStartPre=/bin/sh -c "[ ! -e @bindir@/galera_recovery ] && VAR= || \ + VAR=`@bindir@/galera_recovery --defaults-file=@sysconf2dir@/my%I.cnf`; [ $? -eq 0 ] \ && systemctl set-environment _WSREP_START_POSITION%I=$VAR || exit 1" # Alternate: (remove ConditionPathExists above) # use [mysqld.INSTANCENAME] as sections in my.cnf # -#ExecStartPre=/bin/sh -c "[ ! -e /usr/bin/galera_recovery ] && VAR= || \ -# VAR=`/usr/bin/galera_recovery --defaults-group-suffix=%I`; [ $? -eq 0 ] \ +#ExecStartPre=/bin/sh -c "[ ! -e @bindir@/galera_recovery ] && VAR= || \ +# VAR=`@bindir@/galera_recovery --defaults-group-suffix=%I`; [ $? -eq 0 ] \ # && systemctl set-environment _WSREP_START_POSITION%I=$VAR || exit 1" # Needed to create system tables etc. -# ExecStartPre=/usr/bin/mysql_install_db -u mysql +# ExecStartPre=@scriptdir@/mysql_install_db -u mysql # Start main service # MYSQLD_OPTS here is for users to set in /etc/systemd/system/mariadb@.service.d/MY_SPECIAL.conf @@ -95,12 +95,12 @@ ExecStartPre=/bin/sh -c "[ ! -e /usr/bin/galera_recovery ] && VAR= || \ # Note: Place $MYSQLD_OPTS at the very end for its options to take precedence. -ExecStart=/usr/sbin/mysqld --defaults-file=@INSTALL_SYSCONF2DIR@/my%I.cnf \ +ExecStart=@sbindir@/mysqld --defaults-file=@sysconf2dir@/my%I.cnf \ $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION%I $MYSQLD_OPTS # Alternate: (remove ConditionPathExists above) # use [mysqld.INSTANCENAME] as sections in my.cnf # -# ExecStart=/usr/sbin/mysqld --defaults-group-suffix=%I \ +# ExecStart=@sbindir@/mysqld --defaults-group-suffix=%I \ # $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION%I $MYSQLD_OPTS # Unset _WSREP_START_POSITION environment variable. @@ -166,7 +166,7 @@ LimitNOFILE=16364 # ExecStartPre=sysctl -q -w vm.drop_caches=3 # numa-interleave=1 equalivant -# Change ExecStart=numactl --interleave=all /usr/sbin/mysqld...... +# Change ExecStart=numactl --interleave=all @sbindir@/mysqld...... # crash-script equalivent # FailureAction= |