2、My Scripts

http://www.cnblogs.com/image-eye/archive/2011/10/26/2220405.html      注释详解

1、打印选择菜单,按照选择项一键安装不同的web服务(P134)        

2、开发shell脚本,判断剩余内存大小,如果小于100M(P145)

3、监控web和数据库案例(P150)

4、判断字符串是否为0的多种思路(P161)

5、判断字符串是否为0(P163) 

6、开发启动rsync服务的系统服务脚本(P184)

7、执行shell脚本,打印一个水果菜单-----答案3(P193)

8、实现通过传参的方式往/etc/openvpn_authfile.conf里面添加用户(P199)

9、Apache Web服务管理,利用case开发一个启动start、停止stop、重启restart的服务脚本(P202)

10、使用while循环竖向打印54321(P214)

11、1到100的总和(P216)

12、使用while守护进程的方式监控网站,每隔10秒确定一次网站是否正常(P225)



1、 打印选择菜单,按照选择项一键安装不同的web服务(P134)

 1 #!/bin/bash
 2 #
 3 
 4 path=/server/scripts
 5 [ -d "$path" ] && mkdir -p $path
 6 
 7 cat <<END
 8    1.[install lamp]
 9    2.[install lnmp]
10    3.[exit]
11 END
12 
13 read -p "Please input the num you want: " num 
14 expr $num + 10 &>/dev/null
15 if [ $? -ne 0 ]; then
16     echo "you must be input {1|2|3}."
17     exit 1
18 fi
19 
20 [ $num -eq 1 ] && {
21     echo "start installing lamp."
22     sleep 2
23     [ -x "$path/lamp.sh" ] || {
24         echo "$path/lamp.sh is not exist or can not exec."
25         exit 1
26     }   
27     source $path/lamp.sh
28     exit $?
29 }
30 
31 [ $num -eq 2 ] && {
32     echo "start installing lnmp."
33     sleep 2
34     [ -x "$path/lnmp.sh" ] || {
35         echo "$path/lnmp.sh does not exist or can not be exec."
36         exit 2
37     }
38     source $path/lnmp.sh
39     exit $?
40 }
41 
42 [ $num -eq 3 ] && {
43     echo "you will quit."
44     sleep 1
45     exit 0
46 }
47 
48 [[ ! $sum =~ [1-3] ]] && {
49     echo "input error.the num you input num be {1|2|3}."
50     exit 4
51 }
View Code

 

       


2、开发shell脚本,判断剩余内存大小,如果小于100M。。(P145)


3、监控web和数据库案例(P150)

    

           


4、判断字符串是否为0的多种思路(P161)

   

  


5、判断字符串是否为0(P163) 


5、开发启动rsync服务的系统服务脚本(P185)


6、利用Shell函数开发企业级测试URL检测脚本(P175)


7、执行shell脚本,打印一个水果菜单-----答案3(P193)


8、实现通过传参的方式往/etc/openvpn_authfile.conf里面添加用户(P199)


9、Apache Web服务管理,利用case开发一个启动start、停止stop、重启restart的服务脚本(P202)

   



10、使用while循环竖向打印54321(P214)


11、1到100的总和(P216)

                   


 

12、使用while守护进程的方式监控网站,每隔10秒确定一次网站是否正常(P225)

采用shell数组

      


 

转载于:https://www.cnblogs.com/hanshanxiaoheshang/p/9406694.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值