Commit 33e3c6dc authored by unknown's avatar unknown

Merge lgrimmer@bk-internal.mysql.com:/home/bk/mysql-5.0

into mysql.com:/space/my/mysql-5.0

parents 409b294b 7031cea4
...@@ -57,7 +57,7 @@ unlink $temp or warn "Unable to remove tempfile ($!)\n"; ...@@ -57,7 +57,7 @@ unlink $temp or warn "Unable to remove tempfile ($!)\n";
# First get some info # First get some info
$fullname =~ s,/+$,,; # Remove ending slash if any $fullname =~ s,/+$,,; # Remove ending slash if any
$fullname =~ /^((mysql)-\w+-?\w+?)-([\d\.]+\w?)-.+$/ $fullname =~ /^((mysql)(?:-\w+){1,3})-([\d\.]+\w?)-.+$/
or die "This name is not what I expected - \"$fullname\""; or die "This name is not what I expected - \"$fullname\"";
$default{"name"}= $2; $default{"name"}= $2;
......
...@@ -57,6 +57,17 @@ else ...@@ -57,6 +57,17 @@ else
bindir="$basedir/bin" bindir="$basedir/bin"
fi fi
#
# Use LSB init script functions for printing messages, if possible
#
lsb_functions="/lib/lsb/init-functions"
if test -f $lsb_functions ; then
source $lsb_functions
else
alias log_success_msg="echo \ SUCCESS! "
alias log_failure_msg="echo \ ERROR! "
fi
PATH=/sbin:/usr/sbin:/bin:/usr/bin:$basedir/bin PATH=/sbin:/usr/sbin:/bin:/usr/bin:$basedir/bin
export PATH export PATH
...@@ -78,6 +89,20 @@ parse_arguments() { ...@@ -78,6 +89,20 @@ parse_arguments() {
done done
} }
wait_for_pid () {
for((i=0; i<35; i++)); do
sleep 1
test -s $pid_file && i='' && break
echo $echo_n ".$echo_c"
done
if test -z "$i" ; then
log_success_msg
else
log_failure_msg
fi
}
# Get arguments from the my.cnf file, # Get arguments from the my.cnf file,
# groups [mysqld] [mysql_server] and [mysql.server] # groups [mysqld] [mysql_server] and [mysql.server]
if test -x ./bin/my_print_defaults if test -x ./bin/my_print_defaults
...@@ -154,14 +179,17 @@ case "$mode" in ...@@ -154,14 +179,17 @@ case "$mode" in
then then
# Give extra arguments to mysqld with the my.cnf file. This script may # Give extra arguments to mysqld with the my.cnf file. This script may
# be overwritten at next upgrade. # be overwritten at next upgrade.
echo $echo_n "Starting MySQL"
$bindir/mysqld_safe --datadir=$datadir --pid-file=$pid_file >/dev/null 2>&1 & $bindir/mysqld_safe --datadir=$datadir --pid-file=$pid_file >/dev/null 2>&1 &
wait_for_pid
# Make lock for RedHat / SuSE # Make lock for RedHat / SuSE
if test -w /var/lock/subsys if test -w /var/lock/subsys
then then
touch /var/lock/subsys/mysql touch /var/lock/subsys/mysql
fi fi
else else
echo "Can't execute $bindir/mysqld_safe from dir $basedir" log_failure_msg "Can't execute $bindir/mysqld_safe"
fi fi
;; ;;
...@@ -171,29 +199,18 @@ case "$mode" in ...@@ -171,29 +199,18 @@ case "$mode" in
if test -s "$pid_file" if test -s "$pid_file"
then then
mysqld_pid=`cat $pid_file` mysqld_pid=`cat $pid_file`
echo "Killing mysqld with pid $mysqld_pid" echo $echo_n "Shutting down MySQL"
kill $mysqld_pid kill $mysqld_pid
# mysqld should remove the pid_file when it exits, so wait for it. # mysqld should remove the pid_file when it exits, so wait for it.
wait_for_pid
sleep 1
while [ -s $pid_file -a "$flags" != aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ]
do
[ -z "$flags" ] && echo $echo_n "Wait for mysqld to exit$echo_c" || echo $echo_n ".$echo_c"
flags=a$flags
sleep 1
done
if [ -s $pid_file ]
then echo " gave up waiting!"
elif [ -n "$flags" ]
then echo " done"
fi
# delete lock for RedHat / SuSE # delete lock for RedHat / SuSE
if test -f /var/lock/subsys/mysql if test -f /var/lock/subsys/mysql
then then
rm -f /var/lock/subsys/mysql rm -f /var/lock/subsys/mysql
fi fi
else else
echo "No mysqld pid file found. Looked for $pid_file." log_failure_msg "MySQL PID file could not be found!"
fi fi
;; ;;
...@@ -202,11 +219,21 @@ case "$mode" in ...@@ -202,11 +219,21 @@ case "$mode" in
# running or not, start it again. # running or not, start it again.
$0 stop $0 stop
$0 start $0 start
;; ;;
'reload')
if test -s "$pid_file" ; then
mysqld_pid=`cat $pid_file`
kill -HUP $mysqld_pid && log_success_msg "Reloading service MySQL"
touch $pid_file
else
log_failure_msg "MySQL PID file could not be found!"
fi
;;
*) *)
# usage # usage
echo "Usage: $0 start|stop|restart" echo "Usage: $0 start|stop|restart|reload"
exit 1 exit 1
;; ;;
esac esac
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment