diff options
author | Sergei Golubchik <serg@mariadb.org> | 2018-10-27 20:46:18 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2018-10-27 20:46:38 +0200 |
commit | 37ab7e45963627f3c1ea2dd43d5b305de37bb16f (patch) | |
tree | e07ada7fbde72c438f2a6a6c162e050caf1950f9 /support-files | |
parent | 30c3d6db328d73f1b30be537aceb55d37936fdb9 (diff) | |
parent | 893ebb739e24637985892da1555f2e6f1a8ac5b6 (diff) | |
download | mariadb-git-37ab7e45963627f3c1ea2dd43d5b305de37bb16f.tar.gz |
Merge branch '5.5' into 10.0
Diffstat (limited to 'support-files')
-rw-r--r-- | support-files/mysql.server.sh | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/support-files/mysql.server.sh b/support-files/mysql.server.sh index 794b3ecbbbb..958902620a5 100644 --- a/support-files/mysql.server.sh +++ b/support-files/mysql.server.sh @@ -122,8 +122,9 @@ esac parse_server_arguments() { for arg do + val=`echo "$arg" | sed -e 's/^[^=]*=//'` case "$arg" in - --basedir=*) basedir=`echo "$arg" | sed -e 's/^[^=]*=//'` + --basedir=*) basedir="$val" bindir="$basedir/bin" if test -z "$datadir_set"; then datadir="$basedir/data" @@ -137,14 +138,15 @@ parse_server_arguments() { fi libexecdir="$basedir/libexec" ;; - --datadir=*) datadir=`echo "$arg" | sed -e 's/^[^=]*=//'` + --datadir=*) datadir="$val" datadir_set=1 ;; --log-basename=*|--hostname=*|--loose-log-basename=*) - mysqld_pid_file_path=`echo "$arg.pid" | sed -e 's/^[^=]*=//'` + mysqld_pid_file_path="$val.pid" ;; - --pid-file=*) mysqld_pid_file_path=`echo "$arg" | sed -e 's/^[^=]*=//'` ;; - --service-startup-timeout=*) service_startup_timeout=`echo "$arg" | sed -e 's/^[^=]*=//'` ;; + --pid-file=*) mysqld_pid_file_path="$val" ;; + --service-startup-timeout=*) service_startup_timeout="$val" ;; + --user=*) user="$val"; ;; esac done } @@ -176,6 +178,12 @@ else test -z "$print_defaults" && print_defaults="my_print_defaults" fi +user='@MYSQLD_USER@' + +su_kill() { + su - $user -s /bin/sh -c "kill $*" >/dev/null 2>&1 +} + # # Read defaults file from 'basedir'. If there is no defaults file there # check if it's in the old (depricated) place (datadir) and read it from there @@ -205,7 +213,7 @@ wait_for_gone () { while test $i -ne $service_startup_timeout ; do - if kill -0 "$pid" 2>/dev/null; then + if su_kill -0 "$pid" ; then : # the server still runs else if test ! -s "$pid_file_path"; then @@ -245,7 +253,7 @@ wait_for_ready () { if $bindir/mysqladmin ping >/dev/null 2>&1; then log_success_msg return 0 - elif kill -0 $! 2>/dev/null ; then + elif kill -0 $! ; then : # mysqld_safe is still running else # mysqld_safe is no longer running, abort the wait loop @@ -314,10 +322,9 @@ case "$mode" in then mysqld_pid=`cat "$mysqld_pid_file_path"` - if (kill -0 $mysqld_pid 2>/dev/null) - then + if su_kill -0 $mysqld_pid ; then echo $echo_n "Shutting down MariaDB" - kill $mysqld_pid + su_kill $mysqld_pid # mysqld should remove the pid file when it exits, so wait for it. wait_for_gone $mysqld_pid "$mysqld_pid_file_path"; return_value=$? else @@ -350,7 +357,7 @@ case "$mode" in 'reload'|'force-reload') if test -s "$mysqld_pid_file_path" ; then read mysqld_pid < "$mysqld_pid_file_path" - kill -HUP $mysqld_pid && log_success_msg "Reloading service MariaDB" + su_kill -HUP $mysqld_pid && log_success_msg "Reloading service MariaDB" touch "$mysqld_pid_file_path" else log_failure_msg "MariaDB PID file could not be found!" @@ -361,7 +368,7 @@ case "$mode" in # First, check to see if pid file exists if test -s "$mysqld_pid_file_path" ; then read mysqld_pid < "$mysqld_pid_file_path" - if kill -0 $mysqld_pid 2>/dev/null ; then + if su_kill -0 $mysqld_pid ; then log_success_msg "MariaDB running ($mysqld_pid)" exit 0 else |