Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fix in stop case of Debian init script #36

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions build-ps/debian/percona-server-server-5.6.mysql.init
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ test -x "${PERCONA_PREFIX}"/sbin/mysqld || exit 0

. /lib/lsb/init-functions

SELF=$(cd $(dirname $0); pwd -P)/$(basename $0)
CONF=/etc/mysql/my.cnf
SELF=$(cd "$(dirname "$0")"; pwd -P)/$(basename "$0")
MYADMIN="${PERCONA_PREFIX}/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf"

# priority can be overriden and "-s" adds output to stderr
Expand Down Expand Up @@ -59,8 +58,8 @@ sanity_checks() {
#fi

# check for diskspace shortage
datadir=`mysqld_get_param datadir`
if LC_ALL=C BLOCKSIZE= df --portability $datadir/. | tail -n 1 | awk '{ exit ($4>4096) }'; then
datadir=$(mysqld_get_param datadir)
if LC_ALL=C BLOCKSIZE= df --portability "$datadir"/. | tail -n 1 | awk '{ exit ($4>4096) }'; then
log_failure_msg "$0: ERROR: The partition with $datadir is too full!"
echo "ERROR: The partition with $datadir is too full!" | $ERR_LOGGER
exit 1
Expand All @@ -74,11 +73,11 @@ sanity_checks() {
#
# Usage: boolean mysqld_status [check_alive|check_dead] [warn|nowarn]
mysqld_status () {
ping_output=`$MYADMIN ping 2>&1`; ping_alive=$(( ! $? ))
ping_output=$($MYADMIN ping 2>&1); ping_alive=$(( ! $? ))

ps_alive=0
pidfile=`mysqld_get_param pid-file`
if [ -f "$pidfile" ] && ps `cat $pidfile` >/dev/null 2>&1; then ps_alive=1; fi
pidfile=$(mysqld_get_param pid-file)
if [ -f "$pidfile" ] && ps "$(cat "$pidfile")" >/dev/null 2>&1; then ps_alive=1; fi

if [ "$1" = "check_alive" -a $ping_alive = 1 ] ||
[ "$1" = "check_dead" -a $ping_alive = 0 -a $ps_alive = 0 ]; then
Expand Down Expand Up @@ -137,7 +136,7 @@ case "${1:-''}" in
log_daemon_msg "Stopping MySQL (Percona Server)" "mysqld"
if ! mysqld_status check_dead nowarn; then
set +e
shutdown_out=`$MYADMIN shutdown 2>&1`; r=$?
shutdown_out=$($MYADMIN shutdown 2>&1); r=$?
set -e
if [ "$r" -ne 0 ]; then
log_end_msg 1
Expand All @@ -153,6 +152,15 @@ case "${1:-''}" in
fi
fi

if ! mysqld_status check_dead nowarn && ! mysqld_status check_alive nowarn; then
# mysql is going down...
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do
if mysqld_status check_dead nowarn; then break; fi
sleep 1
echo -n " ."
done
fi

if ! mysqld_status check_dead warn; then
log_end_msg 1
log_failure_msg "Please stop MySQL (Percona Server) manually and read /usr/share/doc/percona-server-server-5.6/README.Debian.gz!"
Expand Down