通过for循环打印5 4 3 2 1[root@shnne ~]# cat for1.sh
#!/bin/sh
for i in 5 4 3 2 1
do
echo $i
done
[root@shnne ~]# cat for2.sh
#!/bin/sh
f...
[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&...
[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...
echo -e "\033[30m 黑色字 \033[0m"
echo -e "\033[31m 红色字 \033[0m"
echo -e "\033[32m 绿色字 \033[0m"
echo -e ...
[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"...
#!/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...
判断内存小于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服务状态
#监控服务状态
ServerMonitor () {
#服务状态监控
timeout=10
fails=0
success=0
while true
do
/usr/bin/wget --timeout=$timeout --tries=1 http://192.168.1.1.101/&nbs...