From 484e88b1e84e49a4911069d0f654b3f5073306e3 Mon Sep 17 00:00:00 2001 From: david hill Date: Mon, 8 Feb 2016 09:15:08 -0600 Subject: [PATCH] add in kill by pid --- dbcon/mysql/mysql-Calpont | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/dbcon/mysql/mysql-Calpont b/dbcon/mysql/mysql-Calpont index d8cbe4dbb..668b03fb3 100755 --- a/dbcon/mysql/mysql-Calpont +++ b/dbcon/mysql/mysql-Calpont @@ -296,6 +296,25 @@ fi [ -f /etc/sysconfig/mysql ] && . /etc/sysconfig/mysql [ -f /etc/conf.d/mysql ] && . /etc/conf.d/mysql +kill_by_pid() { + # let's see if we can kill the 2 mysql procs by hand + # get the our mysql from ps + eval $(ps -ef | grep "$INFINIDB_INSTALL_DIR/mysql//sbin/mysqld" | grep -v grep | head -1 | awk '{printf "pid=%d\n", $2}') + + if [ -n "$pid" ]; then + ppid=$(ps -o ppid= -p $pid) + $SUDO kill -9 $ppid + kill -9 $ppid + sleep 1 + $SUDO kill -9 $pid + kill -9 $pid + echo $echo_n "Force shutting down (no/bad pid file)" + log_success_msg + exit 0 + fi + return +} + case "$mode" in 'start') # Start daemon @@ -349,6 +368,7 @@ case "$mode" in fi exit $return_value else + kill_by_pid log_failure_msg "MySQL server PID file could not be found!" fi ;;