]> git.pld-linux.org Git - packages/mysql.git/blobdiff - mysql.init
- up to 5.6.14
[packages/mysql.git] / mysql.init
index 932768310ab46030a53acd4d861836101384f9b7..b4dd31442ec9eb8291b8b958711a8f3ebbca3eda 100755 (executable)
@@ -359,7 +359,7 @@ mysqlstop() {
 # uses MYSQL_SOCKET - path to mysql socket
 slave_status() {
        # see if slave status can be reported
-       local err=0 slave_status=$(mysql -S $MYSQL_SOCKET -e 'show slave status\G')
+       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
@@ -455,7 +455,7 @@ mysqlinit() {
                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"
@@ -550,7 +550,11 @@ 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
 
@@ -622,40 +626,8 @@ condrestart() {
        start
 }
 
-RETVAL=0
-case "$action" in
-  start)
-       start
-       ;;
-  stop)
-       stop
-       ;;
-  restart)
-       stop
-       start
-       ;;
-  try-restart)
-       condrestart 0
-       ;;
-  force-reload)
-       condrestart 7
-       ;;
-  init)
-       for mysqldir in $DB_CLUSTERS; do
-               mysqlinit "$mysqldir"
-       done
-       exit $?
-       ;;
-  flush-logs)
-       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() {
+       local mysqldir addr port socket pid pids running datadir 
        RETVAL=3
        for mysqldir in $DB_CLUSTERS; do
                mysqlstatus "$mysqldir"
@@ -712,6 +684,43 @@ case "$action" in
                        echo
                done
        fi
+}
+
+RETVAL=0
+case "$action" in
+  start)
+       start
+       ;;
+  stop)
+       stop
+       ;;
+  restart)
+       stop
+       start
+       ;;
+  try-restart)
+       condrestart 0
+       ;;
+  force-reload)
+       condrestart 7
+       ;;
+  init)
+       for mysqldir in $DB_CLUSTERS; do
+               mysqlinit "$mysqldir"
+       done
+       exit $?
+       ;;
+  flush-logs)
+       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|restart|try-restart|force-reload|init|flush-logs|status}"
This page took 0.234061 seconds and 4 git commands to generate.