问轩博客

展开菜单

while计算小练习

while计算小练习
[root@shnne ~]# cat sum_* #!/bin/sh sum=0 i=1 while [ $i -le 100 ] do   let sum=sum+i   let i=i+1 done echo $sum #!/bin/sh sum=0 i=1 while ((i&...

shell编写rsync启动脚本

shell编写rsync启动脚本
[root@shnne ~]# cat rsync_start.sh  #!/bin/bash # chkconfig: 2345 58 80 # description: start and stop service for rsync . /etc/init.d/functions RSYNCBIN=&q...

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...

memcache实现多网站session会话保持配置

memcache实现多网站session会话保持配置
前提:配置好LNMP和LAMP,添加好memcache的扩展1.服务端安装memcached服务端软件注意:memcached用libevent来作事件驱动,所以要先安装libevent。这两个只要./configure    make &&make install即可2.配置客户端支持memcachetar xf memcache-2.2.5.tgzcd memcache-2.2.5/application/php/b...