#!/bin/sh
#this script is created by oldboy 20160410
#fun:compare two num
#V1.0
read -t 10 -p "please input two num:" a b
if [ $a -gt $b ];then
#if (($a > $b));then
echo "yes $a > $b"
elif [ $a -eq $b ];then
echo "yes $a == $b"
else
echo "yes $a < $b"
fi
fack -A修复系统
1.命令行参数或者read读入的方式
2.对读入的数字做参数个数及是参数否数字的判断
3.开发脚本对http服务的监控
4.开发脚本实现对mysql的监控
判断mysql正常启动的几种方法
GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
netstat -lnt|grep 3306|awk -F '[ :]+' '{print $5}
#!/bin/sh
#this script is created by oldboy 20160410
#fun:compare two num
#V1.0
protNum='netstat -lnt|grep 3306|awk -F '[ :]+' '{print $5}'
if[ $portNum eq 3306 ];then
echo "db is running"
else
/data/3306/mysql restart
fi
第二种方法
#!/bin/sh
#this script is created by oldboy 20160410
#244541309@qq.com
#fun:compare two num
#V1.0
protNum=`netstat -lnt|grep 3306|awk -F '[ :]+' '{print $5}'`
if[ "$portNum" == "3306" ];then
echo "db is running"
else
/data/3306/mysql restart
fi
第三种#!/bin/sh
#this script is created by oldboy 20160410
#fun:compare two num
#V1.0
protNum=`netstat -lnt|grep 3306|wc -l`
echo $protNum
if[ $protNum -eq 1 ]then
echo "db is running"
else
/data/3306/mysql restart
#this script is created by oldboy 20160410
#fun:compare two num
#V1.0
read -t 10 -p "please input two num:" a b
if [ $a -gt $b ];then
#if (($a > $b));then
echo "yes $a > $b"
elif [ $a -eq $b ];then
echo "yes $a == $b"
else
echo "yes $a < $b"
fi
fack -A修复系统
1.命令行参数或者read读入的方式
2.对读入的数字做参数个数及是参数否数字的判断
3.开发脚本对http服务的监控
4.开发脚本实现对mysql的监控
判断mysql正常启动的几种方法
GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
netstat -lnt|grep 3306|awk -F '[ :]+' '{print $5}
#!/bin/sh
#this script is created by oldboy 20160410
#fun:compare two num
#V1.0
protNum='netstat -lnt|grep 3306|awk -F '[ :]+' '{print $5}'
if[ $portNum eq 3306 ];then
echo "db is running"
else
/data/3306/mysql restart
fi
第二种方法
#!/bin/sh
#this script is created by oldboy 20160410
#244541309@qq.com
#fun:compare two num
#V1.0
protNum=`netstat -lnt|grep 3306|awk -F '[ :]+' '{print $5}'`
if[ "$portNum" == "3306" ];then
echo "db is running"
else
/data/3306/mysql restart
fi
第三种#!/bin/sh
#this script is created by oldboy 20160410
#fun:compare two num
#V1.0
protNum=`netstat -lnt|grep 3306|wc -l`
echo $protNum
if[ $protNum -eq 1 ]then
echo "db is running"
else
/data/3306/mysql restart
fi
syntax error near unexpected t