msg_stopping "MySQL $clusterdir"
busy
-# TODO
-# graceful mysql shutdown with mysqladmin shutdown requires 'shutdown'
-# privilege. create new user mysqlctl or rename mysql_logrotate to mysqlctl
-# and give it both privs (flush-logs and shutdown)?
-
# try graceful shutdown -- send shutdown command
- /usr/bin/mysqladmin --defaults-file=$MYSQL_CONFIG ${MYSQL_SOCKET:+--socket=$MYSQL_SOCKET} shutdown 2>/dev/null
+ # requires mysql_logrotate user proper privs
+ /usr/bin/mysqladmin --defaults-file=$MYSQL_CONFIG ${MYSQL_SOCKET:+--socket=$MYSQL_SOCKET} shutdown >/dev/null 2>&1
mysqlstatus "$clusterdir"
[ "$MYSQL_PID" != "unknown" ] && kill -TERM "$MYSQL_PID" 2> /dev/null
- # 3 seconds
- for nr in 1 2 3; do
+ # 15 seconds
+ for nr in $(seq 1 15); do
[ -d "/proc/$MYSQL_PID" ] && sleep 1
done
mysqlstatus "$clusterdir"
MYSQL_DATA_DIR="$clusterdir/mysqldb/db"
MYSQL_PIDFILE="$clusterdir/mysqldb/mysql.pid"
MYSQL_SOCKET="$clusterdir/mysqldb/mysql.sock"
+
+ # this $MYSQL_CONFIG will be created later
+ MYSQL_CONFIG="$MYSQL_CLUSTER_DIR/mysqld.conf"
fi
nls "Initializing cluster %s" "$clusterdir"
NOTE: mysql_logrotate password should be placed to $MYSQL_CONFIG in
mysqladmin section. See the manual for more instructions.
-IMPORTANT: The configuration file is mysqld.conf in MYSQL_DB_CLUSTERS directories.
-
END_OF_MSG
else
fail
may be helpful. The latest information about MySQL is available on the
web at http://www.mysql.com/.
-Please check PLD ftp site for newer versions of this package.
+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
flush-logs)
for mysqldir in $DB_CLUSTERS; do
mysqlgetconfig "$mysqldir"
- /usr/bin/mysqladmin --defaults-file="$MYSQL_CONFIG" --socket="$MYSQL_SOCKET" flush-logs
+ # 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
;;
*)