]> git.pld-linux.org Git - packages/mysql.git/blobdiff - mysql.init
- update files (partial)
[packages/mysql.git] / mysql.init
old mode 100644 (file)
new mode 100755 (executable)
index e59017e..62d68e2
@@ -1,12 +1,10 @@
 #!/bin/sh
 #
-# mysql         A very fast and reliable SQL database engine
+# mysql                A very fast and reliable SQL database engine
 #
-# chkconfig:    2345 84 25
+# chkconfig:   2345 84 25
 #
 # description:  A very fast and reliable SQL database engine.
-#
-# $Id$
 
 # Source function library
 . /etc/rc.d/init.d/functions
@@ -28,14 +26,14 @@ if [ -n "$MYSQL_DB_CLUSTERS" ]; then
 fi
 
 if [ -f /etc/mysql/clusters.conf ]; then
-       MYSQL_DB_CLUSTERS=$(awk -F= '!/^#/{print $2}' /etc/mysql/clusters.conf)
-       if [ -z "$MYSQL_DB_CLUSTERS"  ]; then
+       MYSQL_DB_CLUSTERS=$(awk -F= '!/^#/ && /=/{print $2}' /etc/mysql/clusters.conf)
+       if [ -z "$MYSQL_DB_CLUSTERS" ]; then
                nls "Warning: there are no configured clusters."
        fi
 
 else
        nls "Warning: Missing clusters config file %s" /etc/mysql/clusters.conf
-       if [ -z "$MYSQL_DB_CLUSTERS"  ]; then
+       if [ -z "$MYSQL_DB_CLUSTERS" ]; then
                nls "Warning: there are no configured clusters."
                nls "Using default cluster /var/lib/mysql (compatibility mode)"
                MYSQL_DB_CLUSTERS=/var/lib/mysql
@@ -53,6 +51,8 @@ else
        exit 0
 fi
 
+sharedir=/usr/share/percona-server
+
 action="$1"
 
 # any db cluster as command line argument?
@@ -79,8 +79,8 @@ else
        DB_CLUSTERS="$MYSQL_DB_CLUSTERS"
 fi
 
-MYSQL_ERRLOG=/var/log/mysql/err
-MYSQL_START_WAIT_TIME=${MYSQL_START_WAIT_TIME:-15}
+# global error log, if mysqld.conf hasn't migrated to log-error style
+MYSQL_ERRLOG=/var/log/mysql/mysqld.log
 MYSQL_STOP_WAIT_TIME=${MYSQL_STOP_WAIT_TIME:-900}
 
 #
@@ -102,7 +102,7 @@ mysqlstatus() {
        clusterdir="$1"
        mode="$2"
        
-       mysqlgetconfig "$clusterdir"
+       mysqlgetconfig "$clusterdir" status
 
        MYSQL_STATUS="not running"
        MYSQL_PID="unknown"
@@ -125,7 +125,7 @@ mysqlstatus() {
        fi
 
        if [ "$mode" = "start" ]; then
-               MYSQL_GREP_PID=$(grep -lE "^/usr/sbin/mysqld.*${MYSQL_PIDFILE}" /proc/[0-9]*/cmdline 2> /dev/null | awk -F "/" '{ print $3; exit; }')
+               MYSQL_GREP_PID=$(grep -alE "^/usr/sbin/mysqld.*${MYSQL_PIDFILE}" /proc/[0-9]*/cmdline 2> /dev/null | awk -F "/" '{ print $3; exit; }')
                if [ -n "$MYSQL_GREP_PID" ]; then
                        MYSQL_PID=$MYSQL_GREP_PID
                        if grep -qa "$MYSQL_PIDFILE" /proc/$MYSQL_PID/cmdline 2> /dev/null; then
@@ -148,20 +148,23 @@ mysqlstatus() {
 }
 
 # get mysql configuration in variables
-# MYSQL_CONFIG MYSQL_DATA_DIR MYSQL_USER MYSQL_PIDFILE
+# MYSQL_CONFIG MYSQL_CLUSTER_DIR
+# MYSQL_DATA_DIR MYSQL_USER MYSQL_PIDFILE MYSQL_SOCKET MYSQL_PORT MYSQL_BIND_ADDRESS MYSQL_SKIP_NETWORKING MYSQL_LOG_ERROR
 #
 # arguments
 # $1 - db cluster
+# $2 - status | other
 
 mysqlgetconfig() {
-       clusterdir="$1"
+       local clusterdir="$1" config_file
+       local mode="$2"
 
        # emulate old behaviour if only one cluster specified
        if [ "$clusterdir" = "$MYSQL_DB_CLUSTERS" -a "$clusterdir" = "/var/lib/mysql" -a -f /etc/mysqld.conf ]; then
                MYSQL_RA_COMPAT=yes
                config_file=/etc/mysqld.conf
        else
-               config=$(awk -F= -vclusterdir="$clusterdir" '!/^#/{ if (clusterdir == $2) print $1}' /etc/mysql/clusters.conf)
+               local config=$(awk -F= -vclusterdir="$clusterdir" '!/^#/{ if (clusterdir == $2) print $1}' /etc/mysql/clusters.conf)
                if [[ $config = /* ]]; then
                        config_file="$config"
                elif [ -f "/etc/mysql/$config" ]; then
@@ -175,7 +178,11 @@ mysqlgetconfig() {
 
        if [ -z "$config_file" ]; then
                nls "Error: Can't find config file for %s cluster" "$clusterdir"
-               exit 6
+               if [ "$mode" = "status" ]; then 
+                       exit 3
+               else
+                       exit 6
+               fi
        else
                MYSQL_CONFIG="$config_file"
        fi
@@ -183,27 +190,63 @@ mysqlgetconfig() {
        if [ ! -f "$config_file" ]; then
                nls "Error: config file %s not found" "$config_file"
                nls "MySQL can't be run. Did you initialize DB by doing \`$0 init'?"
-               exit 6
+               if [ "$mode" = "status" ]; then 
+                       exit 3
+               else
+                       exit 6
+               fi
        fi
 
-       eval `awk '
-/^[ \t]*\[.*\][ \t]*$/ {
-       match($0,/\[.*\]/)
-       section=substr($0, RSTART + 1, RSTART + RLENGTH - 3)
-}
-section == "mysqld" && $2 ~ "=" {
-       if ($1 == "datadir") {
-               printf("MYSQL_DATA_DIR=%s;", $3)
-       } else if ($1 == "user") {
-               printf("MYSQL_USER=%s;", $3)
-       } else if ($1 == "pid-file") {
-               printf("MYSQL_PIDFILE=%s;", $3)
-       } else if ($1 == "socket") {
-               printf("MYSQL_SOCKET=%s;", $3)
+       # reset to initial state
+       MYSQL_DATA_DIR= MYSQL_USER= MYSQL_PIDFILE= MYSQL_SOCKET= MYSQL_PORT= MYSQL_BIND_ADDRESS= MYSQL_SKIP_NETWORKING= MYSQL_LOG_ERROR=
+
+       eval `awk -F= '
+       {
+               # undos
+               gsub(/\r$/, "");
+
+               # trim spaces
+               gsub(/^[\t ]+|[\t ]+$/, "", $1);
+               gsub(/^[\t ]+|[\t ]+$/, "", $2);
        }
-}
-' $config_file`
 
+       # skip comments and empty lines
+       /^[;#]|^ *$/ { next }
+
+       /^[ \t]*\[.*\][ \t]*$/ {
+               match($0, /\[.*\]/);
+               section = substr($0, RSTART + 1, RSTART + RLENGTH - 3);
+               next;
+       }
+
+       section == "mysqld" {
+               if ($1 == "datadir") {
+                       printf("MYSQL_DATA_DIR=%s;", $2);
+               } else if ($1 == "user") {
+                       printf("MYSQL_USER=%s;", $2);
+               } else if ($1 == "pid-file") {
+                       printf("MYSQL_PIDFILE=%s;", $2);
+               } else if ($1 == "socket") {
+                       printf("MYSQL_SOCKET=%s;", $2);
+               } else if ($1 == "port") {
+                       printf("MYSQL_PORT=%s;", $2);
+               } else if ($1 == "bind-address") {
+                       printf("MYSQL_BIND_ADDRESS=%s;", $2);
+               } else if ($1 == "skip-networking") {
+                       printf("MYSQL_SKIP_NETWORKING=1;");
+               } else if ($1 == "log-error") {
+                       printf("MYSQL_LOG_ERROR=%s;", $2);
+               }
+       }
+       ' $config_file`
+
+       # error log not defined in config file. add one
+       if [ -z "$MYSQL_LOG_ERROR" ]; then
+               MYSQL_LOG_ERROR=$MYSQL_ERRLOG
+       else
+               # unset, so mysqld would use value from config itself
+               unset MYSQL_LOG_ERROR
+       fi
 
        if is_yes "$MYSQL_RA_COMPAT"; then
                MYSQL_DATA_DIR_SUB=""
@@ -223,7 +266,7 @@ section == "mysqld" && $2 ~ "=" {
                exit 6
        fi
 
-       if [ -z $MYSQL_USER ]; then
+       if [ -z "$MYSQL_USER" ]; then
                echo "$(nls 'MySQL user not configured properly')"'!' >&2
                nls "Edit %s and configure it." "$config_file" >&2
                exit 6
@@ -232,7 +275,7 @@ section == "mysqld" && $2 ~ "=" {
 
 # start mysql
 mysqlstart() {
-       clusterdir="$1"
+       local clusterdir="$1"
        mysqlgetconfig "$clusterdir"
        if [ ! -d "$MYSQL_DATA_DIR/mysql" ]; then
                nls "MySQL cluster %s not initialized." "$clusterdir"
@@ -240,17 +283,18 @@ mysqlstart() {
                exit 6
        fi
 
-       msg_starting "MySQL $clusterdir"
-       busy
+       msg_starting "MySQL $clusterdir"; busy
        [ -z "$DEFAULT_SERVICE_RUN_NICE_LEVEL" ] && DEFAULT_SERVICE_RUN_NICE_LEVEL=0
        rm -f "$MYSQL_PIDFILE"
 
+
        TMPDIR=/tmp nice -n ${SERVICE_RUN_NICE_LEVEL:-$DEFAULT_SERVICE_RUN_NICE_LEVEL} \
-               /usr/bin/setsid /usr/sbin/mysqld \
+               /usr/bin/setsid /usr/sbin/mysqld \
                        --defaults-file=$MYSQL_CONFIG \
                        --datadir=$MYSQL_DATA_DIR \
-                       --pid-file=$MYSQL_PIDFILE $MYSQL_OPTIONS \
-               >> $MYSQL_ERRLOG 2>&1 &
+                       --pid-file=$MYSQL_PIDFILE \
+                       ${MYSQL_LOG_ERROR:+--log-error="$MYSQL_LOG_ERROR"} \
+                       $MYSQL_OPTIONS &
        pid=$!
 
        sleep 0.1
@@ -285,7 +329,7 @@ mysqlstart() {
 
 # stop mysql
 mysqlstop() {
-       clusterdir="$1"
+       local clusterdir="$1"
        mysqlstatus "$clusterdir" stop
        msg_stopping "MySQL $clusterdir"
        busy
@@ -313,6 +357,66 @@ mysqlstop() {
        fi
 }
 
+# report slave status
+# uses MYSQL_SOCKET - path to mysql socket
+slave_status() {
+       if [ ! -x /usr/bin/mysql ]; then
+               echo >&2 "Slave status not available: 'mysql' program not installed."
+               return
+       fi
+
+       # see if slave status can be reported
+       local err=0 slave_status=$(mysql --defaults-file="$MYSQL_CONFIG" --socket="$MYSQL_SOCKET" -e 'show slave status\G')
+       if [ -z "$slave_status" ]; then
+               # slave not setup
+               return
+       fi
+
+       printf "Slave Status:\n"
+
+       set -f
+       eval $(echo "$slave_status" | awk -F': ' '/^ *[A-Za-z_]+:/{
+               k = tolower($1);
+               v = substr($0, length($1) + 3);
+               gsub(/\\/, "\\\\\\", v);
+               gsub(/"/, "\\\"", v);
+               gsub(/`/, "\\`", v);
+               gsub(/\$/, "\\$", v);
+               gsub(/\$/, "\\$", v);
+               printf("%s=\"%s\";\n", k, v);
+       }')
+       set +f
+
+       if [ "$slave_io_running" != "Yes" ]; then
+               printf "\tSlave IO not running\n"
+               err=1
+       fi
+       if [ "$slave_sql_running" != "Yes" ]; then
+               printf "\tSlave SQL not running\n"
+               err=1
+       fi
+
+       if [ "$err" = 1 -a "$last_errno" -gt 0 ]; then
+               printf "\tERROR %s: %s\n" "$last_errno" "$last_error"
+       fi
+
+       if [ "$master_log_file" != "$relay_master_log_file" ]; then
+               printf "\tERROR logfile mismatch (%s)\n" "$relay_master_log_file"
+               err=1
+       fi
+
+       if [ -z "$read_master_log_pos" -o -z "$exec_master_log_pos" ]; then
+               printf "\tERROR No info about master\n"
+               err=1
+               return
+       fi
+
+       diff=$(($read_master_log_pos - $exec_master_log_pos))
+       printf "\tread pos: %s (%s) (host: %s:%d)\n" "$read_master_log_pos" "$master_log_file" "$master_host" "$master_port"
+       printf "\texec pos: %s\n" "$exec_master_log_pos"
+       printf "\tdiff: %s\n" "$diff"
+}
+
 #
 # check for running mysql instances; if any instance is running then
 # create subsys lock file
@@ -330,7 +434,7 @@ mysqlsubsys() {
 }
 
 mysqlinit() {
-       clusterdir="$1"
+       local clusterdir="$1"
 
        if [ -f /etc/mysqld.conf ]; then
                nls "Running in \`no cluster compat' mode: can't initialize database."
@@ -351,14 +455,14 @@ mysqlinit() {
                MYSQL_CONFIG="$MYSQL_CLUSTER_DIR/mysqld.conf"
        fi
 
-       show "Initializing cluster %s" "$clusterdir"; echo
+       show "Initializing cluster %s" "$clusterdir"; started
 
        # Check if not exist init database
        if [ -d "$MYSQL_DATA_DIR/mysql" ]; then
                nls "Seems that database is initialized now. Remove by hand %s" "$MYSQL_DATA_DIR/mysql"
                nls "before initializing database."
                nls "For now skipping cluster %s." "$clusterdir"
-               return
+               exit 6
        fi
 
        show "Installing MySQL system tables for $MYSQL_DATA_DIR"
@@ -371,35 +475,36 @@ mysqlinit() {
        chown mysql:mysql "$MYSQL_CLUSTER_DIR/mysqldb" "$MYSQL_DATA_DIR" > /dev/null 2>&1
        chmod 751 "$MYSQL_CLUSTER_DIR" "$MYSQL_CLUSTER_DIR/mysqldb"
 
-       if [ -f /usr/share/mysql/mysqld.conf -a ! -f "$MYSQL_CLUSTER_DIR/mysqld.conf" ]; then
-           sed -e "
-               s#\(datadir.*\)=.*#\1= $MYSQL_DATA_DIR#g;
-               s#\(pid-file.*\)=.*#\1= $MYSQL_PIDFILE#g;
-               s#\(socket.*\)=.*#\1= $MYSQL_SOCKET#g;
-               s#@clusterdir@#$MYSQL_CLUSTER_DIR#g;
-               " /usr/share/mysql/mysqld.conf > "$MYSQL_CLUSTER_DIR/mysqld.conf"
-           chown root:root "$MYSQL_CLUSTER_DIR/mysqld.conf"
-           chmod 640 "$MYSQL_CLUSTER_DIR/mysqld.conf"
-       fi
-
-       if [ ! -e /var/lib/mysql/mysql.sock ] || [ -L /var/lib/mysql/mysql.sock ] && [ -z "$(readlink /var/lib/mysql/mysql.sock)" ]; then
-               sock=${MYSQL_SOCKET#/var/lib/mysql/} # make it relative if possible
-           ln -s "$sock" /var/lib/mysql/mysql.sock
+       if [ -f $sharedir/mysqld.conf -a ! -f "$MYSQL_CLUSTER_DIR/mysqld.conf" ]; then
+               sed -e "
+                       s#\(datadir.*\)=.*#\1= $MYSQL_DATA_DIR#g;
+                       s#\(pid-file.*\)=.*#\1= $MYSQL_PIDFILE#g;
+                       s#\(socket.*\)=.*#\1= $MYSQL_SOCKET#g;
+                       s#@clusterdir@#$MYSQL_CLUSTER_DIR#g;
+               " $sharedir/mysqld.conf > "$MYSQL_CLUSTER_DIR/mysqld.conf"
+               chown root:root "$MYSQL_CLUSTER_DIR/mysqld.conf"
+               chmod 640 "$MYSQL_CLUSTER_DIR/mysqld.conf"
        fi
 
        cat > $MYSQL_DATA_DIR/mysql-init.sql <<-EOF
                CREATE DATABASE mysql;
                use mysql;
-               $(cat /usr/share/mysql/mysql_system_tables.sql)
-               $(sed -e "/@current_hostname/d" /usr/share/mysql/mysql_system_tables_data.sql)
+               $(cat $sharedir/mysql_system_tables.sql)
+               $(sed -e "/@current_hostname/d" $sharedir/mysql_system_tables_data.sql)
 EOF
 
        ok=0
-       /usr/sbin/mysqld --bootstrap --skip-grant-tables \
-               --datadir=$MYSQL_DATA_DIR --user=$MYSQL_USER \
-               --slave-load-tmpdir=$MYSQL_DATA_DIR --tmpdir=$MYSQL_DATA_DIR < \
-               $MYSQL_DATA_DIR/mysql-init.sql 2>> /var/log/mysql/err && ok=1
-       [ -f $MYSQL_DATA_DIR/mysql/host.frm ] || ok=0
+       /usr/sbin/mysqld \
+               --defaults-file=$MYSQL_CLUSTER_DIR/mysqld.conf \
+               --bootstrap \
+               --skip-grant-tables \
+               --datadir=$MYSQL_DATA_DIR \
+               --user=$MYSQL_USER \
+               --slave-load-tmpdir=$MYSQL_DATA_DIR \
+               --tmpdir=$MYSQL_DATA_DIR \
+               --log-error=$MYSQL_ERRLOG \
+               < $MYSQL_DATA_DIR/mysql-init.sql && ok=1
+       [ -f $MYSQL_DATA_DIR/mysql/user.frm ] || ok=0
 
        if [ "$ok" = 1 ]; then
                rm -f $MYSQL_DATA_DIR/mysql-init.sql
@@ -423,11 +528,17 @@ mysqladmin section. See the manual for more instructions.
 END_OF_MSG
                show "Filling help tables..."
                ok=0
-               ( echo "use mysql;"; cat /usr/share/mysql/fill_help_tables.sql ) | \
-                       /usr/sbin/mysqld --bootstrap --skip-grant-tables \
-                       --datadir=$MYSQL_DATA_DIR --user=$MYSQL_USER \
-                       --slave-load-tmpdir=$MYSQL_DATA_DIR --tmpdir=$MYSQL_DATA_DIR < \
-                       $MYSQL_DATA_DIR/mysql-init.sql 2>> /var/log/mysql/err && ok=1
+               ( echo "use mysql;"; cat $sharedir/fill_help_tables.sql ) | \
+                       /usr/sbin/mysqld \
+                       --defaults-file=$MYSQL_CLUSTER_DIR/mysqld.conf \
+                       --bootstrap \
+                       --skip-grant-tables \
+                       --datadir=$MYSQL_DATA_DIR \
+                       --user=$MYSQL_USER \
+                       --slave-load-tmpdir=$MYSQL_DATA_DIR \
+                       --tmpdir=$MYSQL_DATA_DIR \
+                       --log-error=$MYSQL_ERRLOG \
+                       && ok=1
                if [ "$ok" = 1 ]; then
                        ok
                else
@@ -441,11 +552,15 @@ END_OF_MSG
        else
                fail
                cat << END_OF_MSG
-Installation of grant tables FAILED!
+ERROR:
+ERROR:
+ERROR: Installation of grant tables FAILED!
+ERROR:
+ERROR:
 
 The initialization SQL script was preserved at $MYSQL_DATA_DIR/mysql-init.sql
 
-Examine the logs in /var/log/mysql for more information.  You can
+Examine the logs in /var/log/mysql for more information. You can
 also try to start the mysqld daemon with:
 
 /usr/sbin/mysqld --skip-grant &
@@ -457,7 +572,7 @@ shell> mysql -u mysql mysql
 mysql> show tables
 
 Try 'mysqld --help' if you have problems with paths. Setting on
-logging in /etc/mysqld.conf gives you a log in /var/log/mysql/log that
+logging in $MYSQL_DATA_DIR/mysqld.conf gives you a log in /var/log/mysql/query.log that
 may be helpful. The latest information about MySQL is available on the
 web at http://www.mysql.com/.
 
@@ -465,13 +580,21 @@ Please check PLD Linux ftp site for newer versions of this package.
 
 Please consult the MySQL manual section: 'Problems running
 mysql_install_db', and the manual section that describes problems on
-your OS.  Another information source is the MySQL email archive.
-Please check all of the above before mailing us!  And if you do mail
-us, you MUST use the mysqlbug script!
+your OS. Another information source is the MySQL email archive.
 
 END_OF_MSG
                exit 1
        fi
+
+       # if it's first server, register as default
+       if [ ! -e /var/lib/mysql/mysql.sock ] || [ -L /var/lib/mysql/mysql.sock ] && [ -z "$(readlink /var/lib/mysql/mysql.sock)" ]; then
+               sock=${MYSQL_SOCKET#/var/lib/mysql/} # make it relative if possible
+               ln -s "$sock" /var/lib/mysql/mysql.sock
+       fi
+       # same for config, move to /etc
+       if [ ! -e /etc/mysql/mysqld.conf ]; then
+               mv "$MYSQL_CLUSTER_DIR/mysqld.conf" /etc/mysql/mysqld.conf
+       fi
 }
 
 #
@@ -479,12 +602,7 @@ END_OF_MSG
 #
 
 start() {
-       if [ ! -f $MYSQL_ERRLOG ]; then
-               touch $MYSQL_ERRLOG
-       fi
-       chown mysql:mysql $MYSQL_ERRLOG
-       chmod 640 $MYSQL_ERRLOG
-
+       local mysqldir
        for mysqldir in $DB_CLUSTERS; do
                mysqlstatus "$mysqldir" start
                if [ "$MYSQL_STATUS" = "running" ]; then
@@ -497,6 +615,7 @@ start() {
 }
 
 stop() {
+       local mysqldir
        for mysqldir in $DB_CLUSTERS; do
                mysqlstatus "$mysqldir" stop
                if [ "$MYSQL_STATUS" = "not running" ]; then
@@ -508,19 +627,34 @@ stop() {
        mysqlsubsys
 }
 
-RETVAL=0
-case "$action" in
-  start)
-       start
-       ;;
-  stop)
-       stop
-       ;;
-  status)
+condrestart() {
+       if [ ! -f /var/lock/subsys/mysql ]; then
+               msg_not_running "MySQL"
+               RETVAL=$1
+               return
+       fi
+
+       stop
+       start
+}
+
+status() {
+       local mysqldir addr port socket pid pids running datadir 
+       RETVAL=3
        for mysqldir in $DB_CLUSTERS; do
                mysqlstatus "$mysqldir"
                if [ "$MYSQL_STATUS" = "running" ]; then
-                       show "MySQL cluster %s, PID %s" "$mysqldir" "$MYSQL_PID"
+                       RETVAL=0
+                       addr=${MYSQL_BIND_ADDRESS:-0.0.0.0}
+                       port=${MYSQL_PORT:-3306}
+                       socket=${MYSQL_SOCKET:-/var/lib/mysql/mysql.sock}
+                       pid=$MYSQL_PID
+                       nls "MySQL cluster %s, pid %s\n" "$mysqldir" "$pid"
+                       [ -z "$MYSQL_SKIP_NETWORKING" ] && nls "\ttcp:%s:%s\n" "$addr" "$port"
+                       nls "\tunix: %s\n" "$socket"
+
+                       MYSQL_SOCKET=$socket slave_status
+
                        pids="$pids/$MYSQL_PID/"
                        progress "$MYSQL_STATUS"
                else
@@ -536,7 +670,7 @@ case "$action" in
                fi
        done
 
-       if [ $# -gt 1 -a "$running" ]; then
+       if [ $# = 1 -a "$running" ]; then
                nls "Warning: MySQL Daemon processes not under clusters.conf control:"
                # see if we can display their status
                for pid in $running; do
@@ -545,7 +679,15 @@ case "$action" in
                        mysqldir=${datadir%/mysqldb/db} # strip /mysqldb/db
                        mysqlstatus "$mysqldir"
                        if [ "$MYSQL_STATUS" = "running" ]; then
-                               show "MySQL cluster %s, PID %s" "$mysqldir" "$pid"
+                               addr=${MYSQL_BIND_ADDRESS:-0.0.0.0}
+                               port=${MYSQL_PORT:-3306}
+                               socket=${MYSQL_SOCKET:-/var/lib/mysql/mysql.sock}
+                               nls "MySQL cluster %s, pid %s\n" "$mysqldir" "$pid"
+                               [ -z "$MYSQL_SKIP_NETWORKING" ] && nls "\ttcp:%s:%s\n" "$addr" "$port"
+                               nls "\tunix: %s\n" "$socket"
+
+                               MYSQL_SOCKET=$socket slave_status
+
                                progress "$MYSQL_STATUS"
                        else
                                show "MySQL cluster %s" "$mysqldir"
@@ -554,11 +696,26 @@ case "$action" in
                        echo
                done
        fi
+}
+
+RETVAL=0
+case "$action" in
+  start)
+       start
+       ;;
+  stop)
+       stop
        ;;
-  restart|force-reload)
+  restart)
        stop
        start
        ;;
+  try-restart)
+       condrestart 0
+       ;;
+  force-reload)
+       condrestart 7
+       ;;
   init)
        for mysqldir in $DB_CLUSTERS; do
                mysqlinit "$mysqldir"
@@ -566,16 +723,19 @@ case "$action" in
        exit $?
        ;;
   flush-logs)
-       for mysqldir in $DB_CLUSTERS; do
-           mysqlgetconfig "$mysqldir"
+       for mysqldir in $DB_CLUSTERS; do
+               mysqlgetconfig "$mysqldir"
                # just if mysqld is really running
                if /usr/bin/mysqladmin --defaults-file="$MYSQL_CONFIG" --socket="$MYSQL_SOCKET" ping >/dev/null 2>&1; then
                        /usr/bin/mysqladmin --defaults-file="$MYSQL_CONFIG" --socket="$MYSQL_SOCKET" flush-logs
                fi
        done
        ;;
+  status)
+       status
+       ;;
   *)
-       msg_usage "$0 {start|stop|init|restart|force-reload|status}"
+       msg_usage "$0 {start|stop|restart|try-restart|force-reload|init|flush-logs|status}"
        exit 3
 esac
 
This page took 0.225617 seconds and 4 git commands to generate.