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数组

      


 

posted @ 2018-08-02 13:45  Study~Column  阅读(171)  评论(0编辑  收藏  举报