zoukankan      html  css  js  c++  java
  • mysql服务启动失败

    #!/bin/bash
    . /etc/rc.d/init.d/functions
    MPORT=`netstat -atnlp | grep 3306| wc -l`
    MPROC=`ps ax | grep mysqld | grep -v mysqld | wc -l`
    MSOCK=/var/lib/mysqld/mysql.sock
    MPROG=mysqld
    
    if [ $MPORT -ne 0 -a -S	$MSOCK ];then
    	action "mysql db is running" /bin/true
    else
    	/etc/init.d/mysqld start &> /dev/null
    	if [ $MPORT -ne 0 -a -S $MSOCK ];then
    	rm -fr $MSOCK
    	while true
    	do
    	killall $MPROG  &> /dev/null
    	[ $? -ne 0 ] && break
    	sleep 1
    	done
    	/etc/init.d/mysqld start &> /dev null && MSTAT="success" || MSTAT="failure"
    	date >> /tmp/mysqllog
    	echo "mysql db is $MSTAT" >> /tmp/mysqllog
    	mail -s "mysql db is $MSTAT" root < /tmp/mysqllog
    	fi
    fi
    
  • 相关阅读:
    hdu 4370
    lightoj 1074
    poj 1026
    poj 3159
    poj3660 cow contest
    hdu 4069 垃圾数独
    操作系统概念题复习
    ARM指令
    C++ 抢占时优先级进程调度
    Docker 入门
  • 原文地址:https://www.cnblogs.com/hanfei-1005/p/5708254.html
Copyright © 2011-2022 走看看