diff options
author | Jo-Philipp Wich <jo@mein.io> | 2016-12-20 16:20:26 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-20 16:20:26 +0100 |
commit | 98e3fbff59e34fcc877961039caa2e3529154827 (patch) | |
tree | 8c924874d6d530a6eb276ef04b0b2a3f45f2f027 /utils | |
parent | c964379fc4aed586d5f5495aed5e9c3b3a095de5 (diff) | |
parent | 20c881a072f325a082b1595c044d19214820dec9 (diff) |
Merge pull request #3605 from bittorf/mysqld-allow_spaces_in_config
mysql-server: initscript: allow spaces in 'mysql-config' datadir
Diffstat (limited to 'utils')
-rw-r--r-- | utils/mysql/files/mysqld.init | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/utils/mysql/files/mysqld.init b/utils/mysql/files/mysqld.init index eec96c085..98c8c65c4 100644 --- a/utils/mysql/files/mysqld.init +++ b/utils/mysql/files/mysqld.init @@ -7,24 +7,26 @@ STOP=10 SERVICE_DAEMONIZE=1 SERVICE_WRITE_PID=1 SERVICE_STOP_TIME=9 - -error() { - echo "${initscript}:" "$@" 1>&2 -} +PROG='/usr/bin/mysqld' start() { - local datadir=$(sed -n -e "s/^[[:space:]]*datadir[[:space:]]*=[[:space:]\"']*\([^[:space:]\"']*\)[[:space:]\"']*/\1/p" /etc/my.cnf) - if [ ! -d "$datadir" ]; then - error "Error: datadir '$datadir' in /etc/my.cnf doesn't exist" + local conf='/etc/my.cnf' + local datadir="$( sed -nE "s/^\s*datadir\s*=\s*('([^']*)'|\x22([^\x22]*)\x22|(.*\S))\s*$/\2\3\4/p" "$conf" )" + + [ -d "$datadir" ] || { + logger -s "[ERROR] datadir '$datadir' in '$conf' does not exist" return 1 - fi - if [ ! -f "$datadir/mysql/tables_priv.MYD" ]; then - error "Error: I didn't detect a privileges table, you might need to run mysql_install_db --force to initialize the system tables" + } + + [ -f "$datadir/mysql/tables_priv.MYD" ] || { + logger -s "[ERROR] can not detect privileges table, you might need to" + logger -s "run 'mysql_install_db --force' to initialize the system tables" return 1 - fi - service_start /usr/bin/mysqld + } + + service_start "$PROG" } stop() { - service_stop /usr/bin/mysqld + service_stop "$PROG" } |