Shell Menu Frame

Source: Internet
Author: User

#!/bin/sh

Cat () {

Echo-e "${aa} ===================================== ${res}"

Echo-e "${DD} ======== 1.mysql function look ====== ${res}"

Echo-e "${ff} ======== 2.samba function look ====== ${res}"

Echo-e "${CC} ======== 3.postfix function look = = = ${res}"

Echo-e "${gg} ======== 4.or please exit ======= ${res}"

Echo-e "${ee} ===================================== ${res}"

}

User1 () {

Echo-e "${aa} ===================================== ${res}"

Echo-e "${dd} ======== 1.look mysql process ======= ${res}"

Echo-e "${dd} ======== 2.look mysql port ======= ${res}"

Echo-e "${dd} ======== 3.install mysql ======= ${res}"

Echo-e "${dd} ======== 4.or please exit ======= ${res}"

Echo-e "${ee} ===================================== ${res}"

}


User2 () {

Echo-e "${aa} ===================================== ${res}"

Echo-e "${ff} ======== 1.look Samba process ======= ${res}"

Echo-e "${ff} ======== 2.look Samba port ======= ${res}"

Echo-e "${ff} ======== 3.install samba ======= ${res}"

Echo-e "${ff} ======== 4.or please exit ======= ${res}"

Echo-e "${ee} ===================================== ${res}"

}

User3 () {

Echo-e "${aa} ===================================== ${res}"

Echo-e "${CC} ======== 1.look postfix process ===== ${res}"

Echo-e "${CC} ======== 2.look postfix port ===== ${res}"

Echo-e "${CC} ======== 3.install postfix ===== ${res}"

Echo-e "${CC} ======== 4.or please exit ===== ${res}"

Echo-e "${ee} ===================================== ${res}"

}


PD1 () {

User1

For ((i=1;i<=5;i++))

Do

Read-p "Please enter the MySQL function serial number:" A1

Expr $a 1 + 1 &>/dev/null

If [$?-eq 0]&& ($a 1<=4); then

Break

Else

S=5

tg1=$ (($s-$i))

Echo-e "${dd}" the value you entered $a1 does not meet the following criteria!${res} "

Echo-e "${DD} Please enter the number in {1|2|3|4}!${res}"

Echo-e "${DD} You have entered the $i times, and the opportunity to enter $TG1 times!${res}" && continue

Fi

Done

Expr $a 1 + 1 &>/dev/null

If [$?-eq 0];then

If [$a 1-eq 1]&&[-n $a 1];then

nat1=$ (ps-ef | grep "MySQL" | grep-v "root" |wc-l)

Expr $NAT 1 + 0 &>/dev/null

If [$?-eq 0];then

Ps-ef | grep "MySQL"

Echo-e "${dd} view MySQL process success!${res}"

Else

Echo-e "${dd} view MySQL process failed!${res}"

ECHO-E "${dd}mysql Service not open!${res}"

Fi

elif [$a 1-eq 2]&&[-n $a 1];then

nat11=$ (Netstat-tlun | grep "3306" |wc-l)

Expr $NAT 0 &>/dev/null

If [$?-eq 0];then

/bin/netstat-tlun | grep "3306"

Echo-e "${dd} view MYSQL 3306 port success!${res}"

Else

Echo-e "${dd} view MYSQL 3306 port failed!${res}"

Echo-e "${dd}mysql 3306 Service not open!${res}"

Fi

elif [$a 1-eq 3]&&[-n $a 1];then

Echo-e "${dd} Sorry, no MySQL installation function!${res}"

elif [$a 1-eq 4]&&[-n $a 1];then

Echo-e "${aa} ======= has exited the MySQL feature menu interface!=======${res}"

Exit

Else

Echo-e "${DD} you entered is not {1|2|3|4} number!${res}"

Fi

Else

Echo-e "${DD} you entered is not {1|2|3|4} number!${res}"

Fi

}


PD2 () {

User2

For ((ii=1;ii<=5;ii++))

Do

Read-p "Please enter the Samba feature serial number:" A2

Expr $a 2 + 1 &>/dev/null

If [$?-eq 0]&& ($a 2<=4); then

Break

Else

S=5

tg2=$ (($s-$ii))

Echo-e "${ff}" the value you entered $a1 does not meet the following criteria!${res} "

Echo-e "${FF} Please enter the number in {1|2|3|4}!${res}"

Echo-e "${FF} You have entered the $ii times, and the opportunity to enter $TG2 times!${res}" && continue

Fi

Done

Expr $a 2 + 1 &>/dev/null

If [$?-eq 0];then

If [$a 2-eq 1]&&[-n $a 2];then

nat11=$ (ps-ef| grep "SMB" | grep-v "grep" |wc-l)

nat12=$ (ps-ef| grep "NMB" | grep-v "grep" |wc-l)

Expr $NAT + $NAT + 0 &>/dev/null

If [$?-eq 0];then

/bin/ps-ef| grep "SMB" | Grep-v "grep"

/bin/ps-ef| grep "NMB" | Grep-v "grep"

Echo-e "${ff} View Samba process success!${res}"

Else

Echo-e "${ff} View Samba process failed!${res}"

ECHO-E "${ff}samba Service not open!${res}"

Fi

elif [$a 2-eq 2]&&[-n $a 2];then

nat21=$ (Netstat-tlun | grep "445" |grep "0.0.0.0" |wc-l)

nat22=$ (Netstat-tlun | grep "139" |grep "0.0.0.0" |wc-l)

nat23=$ (Netstat-tlun | grep "138" |grep "0.0.0.0" |wc-l)

nat24=$ (Netstat-tlun | grep "137" |grep "0.0.0.0" |wc-l)

Expr $NAT + $NAT + $NAT + $NAT + 0 &>/dev/null

If [$?-eq 0];then

Netstat-tlun | grep "445" |grep "0.0.0.0"

Netstat-tlun | grep "139" |grep "0.0.0.0"

Netstat-tlun | grep "138" |grep "0.0.0.0"

Netstat-tlun | grep "137" |grep "0.0.0.0"

Echo-e "${ff}" view "445" "139" "138" "137" Port succeeded!${res} "

Else

Echo-e "${ff}" view "445" "139" "138" "137" Port failed!${res} "

ECHO-E "${ff}samba Service not open!${res}"

Fi

elif [$a 2-eq 3]&&[-N $a 2];then

Echo-e "${ff} Sorry, no Samba installation feature!${res}"

elif [$a 2-eq 4]&&[-n $a 2];then

Echo-e "${aa} ======= has exited Samba feature menu interface!=======${res}"

Exit

Else

Echo-e "${FF} you entered is not {1|2|3|4} number!${res}"


Fi

Else

Echo-e "${FF} you entered is not {1|2|3|4} number!${res}"


Fi

}


PD3 () {

User3

For ((iii=1;iii<=5;iii++))

Do

Read-p "Please enter the Postfix function serial number:" A3

Expr $a 3 + 1 &>/dev/null

If [$?-eq 0]&& ($a 3<=4); then

Break

Else

Sss=5

tg3=$ (($sss-$III))

Echo-e "${CC}" the value you entered $a1 does not meet the following criteria!${res} "

Echo-e "${CC} Please enter the number in {1|2|3|4}!${res}"

Echo-e "${CC} You have entered the $III times, and the opportunity to enter $TG3 times!${res}" && continue

Fi

Done

Expr $a 3 + 1 &>/dev/null

If [$?-eq 0];then

If [$a 3-eq 1];then

nat3=$ (ps-ef | grep postfix | grep-v "grep" |wc-l)

Expr $NAT 3 + 0 &>/dev/null

If [$?-eq 0];then

/bin/ps-ef | grep postfix | Grep-v "grep"

Echo-e "${CC} view Postfix process success!${res}"

Else

Echo-e "${CC} view Postfix process failed!${res}"

Fi

elif [$a 3-eq 2];then

nat33=$ (Netstat-tlun | grep | grep "TCP" |wc-l)

Expr $NAT + 0 &>/dev/null

If [$?-eq 0];then

Netstat-tlun | grep "25" | grep "TCP"

Echo-e "${CC} View POSTFIX terminal 25th success!${res}"

Else

Echo-e "${CC} View POSTFIX Port 25th failed!${res}"

ECHO-E "${cc}postfix Service not open!${res}"

Fi

elif [$a 3-eq 3];then

Echo-e "${CC} Sorry, no postfix installation function!${res}"

elif [$a 3-eq 4];then

Echo-e "${aa} ====== exited postfix function menu interface!======${res}"

Exit

Else

Echo-e "${CC} you entered is not {1|2|3|4} number!${res}"

Fi

Else

Echo-e "${CC} you entered is not {1|2|3|4} number!${res}"

Fi

}


PD4 () {

Echo-e "${aa} ========== has exited the feature menu interface!=========${res}"

Exit

}



This article from "12177655" blog, declined reprint!

Shell Menu Frame

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.