diff options
Diffstat (limited to 'support-files/mysql.server.sh')
-rw-r--r-- | support-files/mysql.server.sh | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/support-files/mysql.server.sh b/support-files/mysql.server.sh index 97d3059c2ea..f3620d388c4 100644 --- a/support-files/mysql.server.sh +++ b/support-files/mysql.server.sh @@ -25,7 +25,6 @@ # Description: MariaDB is a very fast and reliable SQL database engine. ### END INIT INFO -# If you install MariaDB on some other places than @prefix@, then you # have to do one of the following things for this script to work: # # - Run this script from within the MariaDB installation directory @@ -48,7 +47,7 @@ datadir= # Default value, in seconds, afterwhich the script should timeout waiting # for server start. -# Value here is overriden by value in my.cnf. +# Value here is overridden by value in my.cnf. # 0 means don't wait at all # Negative numbers mean to wait indefinitely service_startup_timeout=900 @@ -97,6 +96,11 @@ lsb_functions="/lib/lsb/init-functions" if test -f $lsb_functions ; then . $lsb_functions else + # Include non-LSB RedHat init functions to make systemctl redirect work + init_functions="/etc/init.d/functions" + if test -f $init_functions; then + . $init_functions + fi log_success_msg() { echo " SUCCESS! $@" @@ -114,12 +118,6 @@ mode=$1 # start or stop [ $# -ge 1 ] && shift - -other_args="$*" # uncommon, but needed when called from an RPM upgrade action - # Expected: "--skip-networking --skip-grant-tables" - # They are not checked here, intentionally, as it is the resposibility - # of the "spec" file author to give correct arguments only. - case `echo "testing\c"`,`echo -n testing` in *c*,-n*) echo_n= echo_c= ;; *c*,*) echo_n=-n echo_c= ;; @@ -211,6 +209,7 @@ else fi parse_server_arguments `$print_defaults $extra_args --mysqld mysql.server` +parse_server_arguments "$@" # wait for the pid file to disappear wait_for_gone () { @@ -308,7 +307,7 @@ case "$mode" in then # Give extra arguments to mysqld with the my.cnf file. This script # may be overwritten at next upgrade. - $bindir/mysqld_safe --datadir="$datadir" --pid-file="$mysqld_pid_file_path" $other_args & + $bindir/mysqld_safe --datadir="$datadir" --pid-file="$mysqld_pid_file_path" "$@" & wait_for_ready; return_value=$? # Make lock for RedHat / SuSE @@ -355,8 +354,11 @@ case "$mode" in 'restart') # Stop the service and regardless of whether it was # running or not, start it again. - if $0 stop $other_args; then - $0 start $other_args + if $0 stop "$@"; then + if ! $0 start "$@"; then + log_failure_msg "Failed to restart server." + exit 1 + fi else log_failure_msg "Failed to stop running server, so refusing to try to start." exit 1 @@ -433,10 +435,21 @@ case "$mode" in fi exit $r ;; + 'bootstrap') + if test "$_use_systemctl" == 1 ; then + log_failure_msg "Please use galera_new_cluster to start the mariadb service with --wsrep-new-cluster" + exit 1 + fi + # Bootstrap the cluster, start the first node + # that initiate the cluster + echo $echo_n "Bootstrapping the cluster.. " + $0 start $other_args --wsrep-new-cluster + exit $? + ;; *) # usage basename=`basename "$0"` - echo "Usage: $basename {start|stop|restart|reload|force-reload|status|configtest} [ MariaDB server options ]" + echo "Usage: $basename {start|stop|restart|reload|force-reload|status|configtest|bootstrap} [ MariaDB server options ]" exit 1 ;; esac |