问轩博客

展开菜单

case小练习

case小练习
echo -e "\033[30m 黑色字 \033[0m"   echo -e "\033[31m 红色字 \033[0m"   echo -e "\033[32m 绿色字 \033[0m"   echo -e ...

nginx的Shell启动脚本

nginx的Shell启动脚本
[root@shnne ~]# cat nginxd.sh #!/bin/bash # chkconfig: 2345 58 80 # description: start and stop service for nginx #定义的变量最好是大写. nginx_bin="/application/nginx/sbin/nginx" pid="/application/nginx1.6.2/logs/nginx.pid"...

通过Shell来监测MySQL状态

通过Shell来监测MySQL状态
#!/bin/sh port=`netstat -antup|grep mysqld|wc -l` process=`ps -ef|grep mysqld|grep -v grep|wc -l` if [ $port -ne 1 ] && [ $process -ne 2&nb...

IF语句小练习

IF语句小练习
判断内存小于100,邮件报警[root@shnne ~]# sh baojing.sh  the mem is 570,it's ok. [root@shnne ~]# vim baojing.sh  #!/bin/sh memvalue=`free -m|awk 'NR==3 {print $...

比较两个整数的大小

比较两个整数的大小
#!/bin/sh #defined the number read -p "please input two number:" a b [ -z "$a" ] || [ -z "$b" ] && { &n...

判断文件的后缀名

判断文件的后缀名
#!/bin/sh if expr "$1" : ".*\.pub" &>/dev/null  then    echo "you are using $1"  else    echo "you ...

​利用let计数监控web服务状态

​利用let计数监控web服务状态
利用let计数监控web服务状态 #监控服务状态 ServerMonitor () { #服务状态监控 timeout=10 fails=0 success=0 while true  do      /usr/bin/wget --timeout=$timeout --tries=1 http://192.168.1.1.101/&nbs...

shell批量添加用户密码

shell批量添加用户密码
[root@localhost ~]# cat user.sh #!/bin/bash for i in `seq 1 20` do   pw=`echo $[$RANDOM]|md5sum|cut -c 1-4`   useradd user$i   echo "u...