方法一
#!/bin/bash 
#DATE 2013/11/25
#MAIL gccmx@163.com 
#FUNCTION check the mysql status,if not run start mysql. 
#Create by Chenchao Gao 
checkMysql(){ 
        CMDCHECK=`lsof -i:3306 &>/dev/null` 
        Port="$?"
        PIDCHECK=`ps aux|grep mysqld|grep -v grep` 
        PID="$?"
        if [ "$Port" -eq "0" -a "$PID" -eq 0 ];then 
                return 200
        else
                return 500
        fi 
} 
startMysql(){ 
        /etc/init.d/mysqld start 
} 
checkMysql 
if [ $? == 200 ];then 
        echo "Mysql is running..."
else
        startMysql 
        checkMysql 
        if [ $? != 200 ];then 
                while true
                do
                        killall mysqld 
                        sleep 2
                        [ $? != 0 ]&&break
                done 
                startMysql 
        fi 
fi
方法二
#!/bin/bash  
#mysql check  
PORT="0"  
PORT=`netstat -lnt | grep 3306 | wc -l `  
echo $PORT  
if [ $PORT -eq 1 ]  
 then  
    echo "mysql is  running"  
else  
    echo "mysql is not  running"  
    echo "progrome reeady to start mysql "  

sudo service mysql start  
./check_mysql.sh  
fi

转载地址:http://www.linuxidc.com/Linux/2013-11/93333.htm

centos 安装 bento4 处理mp4 为 MPEG-DASH流

Bento4 Bento4是一个C ++类库和工具,旨在读取和写入ISO-MP4文件。此格式在国际规范ISO / IEC 14496-12、14496-14和14496-15中定义。该格式是Apple Quicktime...

阅读全文

centos7 yum安装ffmpeg

centos7 yum安装ffmpeg $ yum install epel-release $ yum localinstall --nogpgcheck https://download1.rpmfusion.org/free/el/rpmfusion-free-release-7....

阅读全文

apache-kafka 和apache-zookeeper 设置 systemd服务和开机启动

参考:https://gist.github.com/vipmax/9ceeaa02932ba276fa810c923dbcbd4f 启动命令 #启动 $ systemctl daemon-reload $ systemctl enable kafka-zookeeper.s...

阅读全文

欢迎留言