diff options
author | mtaylor@qualinost.(none) <> | 2007-04-12 11:35:16 -0700 |
---|---|---|
committer | mtaylor@qualinost.(none) <> | 2007-04-12 11:35:16 -0700 |
commit | 729a6fd02a8739253574bd766f7dd44902dda46d (patch) | |
tree | c55b7f56ea95657070cd75d514f0b0b96e35010e /support-files/mysql.server.sh | |
parent | 85695a3d1913ad52b841b0e60769b1fb6979f41f (diff) | |
parent | 99c5f418af1e2076b9f66624559f39288129c17a (diff) | |
download | mariadb-git-729a6fd02a8739253574bd766f7dd44902dda46d.tar.gz |
Merge qualinost.(none):/home/mtaylor/src/mysql/mysql-5.0-maint
into qualinost.(none):/home/mtaylor/src/mysql/mysql-5.1-new-maint
Diffstat (limited to 'support-files/mysql.server.sh')
-rw-r--r-- | support-files/mysql.server.sh | 52 |
1 files changed, 42 insertions, 10 deletions
diff --git a/support-files/mysql.server.sh b/support-files/mysql.server.sh index d2742c548b6..92d9731e72d 100644 --- a/support-files/mysql.server.sh +++ b/support-files/mysql.server.sh @@ -261,13 +261,13 @@ else esac fi -# Safeguard (relative paths, core dumps..) -cd $basedir - case "$mode" in 'start') # Start daemon + # Safeguard (relative paths, core dumps..) + cd $basedir + manager=$bindir/mysqlmanager if test -x $libexecdir/mysqlmanager then @@ -362,20 +362,52 @@ case "$mode" in fi ;; - 'reload') + 'reload'|'force-reload') if test -s "$server_pid_file" ; then - mysqld_pid=`cat $server_pid_file` + read mysqld_pid < $server_pid_file kill -HUP $mysqld_pid && log_success_msg "Reloading service MySQL" touch $server_pid_file else log_failure_msg "MySQL PID file could not be found!" + exit 1 fi ;; - - *) - # usage - echo "Usage: $0 {start|stop|restart|reload} [ MySQL server options ]" - exit 1 + 'status') + # First, check to see if pid file exists + if test -s "$server_pid_file" ; then + read mysqld_pid < $server_pid_file + if kill -0 $mysqld_pid 2>/dev/null ; then + log_success_msg "MySQL running ($mysqld_pid)" + exit 0 + else + log_failure_msg "MySQL is not running, but PID file exists" + exit 1 + fi + else + # Try to find appropriate mysqld process + mysqld_pid=`pidof $sbindir/mysqld` + if test -z $mysqld_pid ; then + if test "$use_mysqld_safe" = "0" ; then + lockfile=/var/lock/subsys/mysqlmanager + else + lockfile=/var/lock/subsys/mysql + fi + if test -f $lockfile ; then + log_failure_msg "MySQL is not running, but lock exists" + exit 2 + fi + log_failure_msg "MySQL is not running" + exit 3 + else + log_failure_msg "MySQL is running but PID file could not be found" + exit 4 + fi + fi + ;; + *) + # usage + echo "Usage: $0 {start|stop|restart|reload|force-reload|status} [ MySQL server options ]" + exit 1 ;; esac |