#!/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 "请输入MYSQL功能序列号: " a1
expr $a1 + 1 &>/dev/null
if [ $? -eq 0 ]&&(($a1<=4));then
break
else
s=5
tg1=$(( $s - $i ))
echo -e "${DD}你输入的数值$a1不满足以下条件!${RES}"
echo -e "${DD}请输入 {1|2|3|4} 之中的数字!${RES}"
echo -e "${DD}您已输入第$i次,还有$tg1次输入的机会!${RES}"&& continue
fi
done
expr $a1 + 1 &>/dev/null
if [ $? -eq 0 ];then
if [ $a1 -eq 1 ]&&[ -n $a1 ];then
NAT1=$(ps -ef | grep "mysql" | grep -v "root" |wc -l)
expr $NAT1 + 0 &>/dev/null
if [ $? -eq 0 ];then
ps -ef | grep "mysql"
echo -e "${DD}查看MYSQL进程成功!${RES}"
else
echo -e "${DD}查看MYSQL进程失败!${RES}"
echo -e "${DD}MYSQL服务没开启!${RES}"
fi
elif [ $a1 -eq 2 ]&&[ -n $a1 ];then
NAT11=$(netstat -tlun | grep "3306" |wc -l)
expr $NAT11 + 0 &>/dev/null
if [ $? -eq 0 ];then
/bin/netstat -tlun | grep "3306"
echo -e "${DD}查看 MYSQL 3306 端口成功!${RES}"
else
echo -e "${DD}查看 MYSQL 3306 端口失败!${RES}"
echo -e "${DD}MYSQL 3306 服务没开启!${RES}"
fi
elif [ $a1 -eq 3 ]&&[ -n $a1 ];then
echo -e "${DD}不好意思,没设MYSQL安装功能!${RES}"
elif [ $a1 -eq 4 ]&&[ -n $a1 ];then
echo -e "${AA} =======已退出MYSQL功能菜单界面!=======${RES}"
exit
else
echo -e "${DD}您输入的不是 {1|2|3|4} 数字!${RES}"
fi
else
echo -e "${DD}您输入的不是 {1|2|3|4} 数字!${RES}"
fi
}
PD2(){
user2
for (( ii=1;ii<=5;ii++ ))
do
read -p "请输入SAMBA功能序列号: " a2
expr $a2 + 1 &>/dev/null
if [ $? -eq 0 ]&&(($a2<=4));then
break
else
s=5
tg2=$(( $s - $ii ))
echo -e "${FF}你输入的数值$a1不满足以下条件!${RES}"
echo -e "${FF}请输入 {1|2|3|4} 之中的数字!${RES}"
echo -e "${FF}您已输入第$ii次,还有$tg2次输入的机会!${RES}"&& continue
fi
done
expr $a2 + 1 &>/dev/null
if [ $? -eq 0 ];then
if [ $a2 -eq 1 ]&&[ -n $a2 ];then
NAT11=$(ps -ef| grep "smb"| grep -v "grep"|wc -l)
NAT12=$(ps -ef| grep "nmb"| grep -v "grep"|wc -l)
expr $NAT11 + $NAT12 + 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}查看SAMBA进程成功!${RES}"
else
echo -e "${FF}查看SAMBA进程失败!${RES}"
echo -e "${FF}SAMBA服务没开启!${RES}"
fi
elif [ $a2 -eq 2 ]&&[ -n $a2 ];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 $NAT21 + $NAT22 + $NAT23 + $NAT24 + 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}查看"445" "139" "138" "137" 端口成功!${RES}"
else
echo -e "${FF}查看"445" "139" "138" "137" 端口失败!${RES}"
echo -e "${FF}SAMBA服务没开启!${RES}"
fi
elif [ $a2 -eq 3 ]&&[ -n $a2 ];then
echo -e "${FF}不好意思,没设SAMBA安装功能!${RES}"
elif [ $a2 -eq 4 ]&&[ -n $a2 ];then
echo -e "${AA} =======已退出SAMBA功能菜单界面!=======${RES}"
exit
else
echo -e "${FF}您输入的不是 {1|2|3|4} 数字!${RES}"
fi
else
echo -e "${FF}您输入的不是 {1|2|3|4} 数字!${RES}"
fi
}
PD3(){
user3
for (( iii=1;iii<=5;iii++ ))
do
read -p "请输入POSTFIX功能序列号: " a3
expr $a3 + 1 &>/dev/null
if [ $? -eq 0 ]&&(($a3<=4));then
break
else
sss=5
tg3=$(( $sss - $iii ))
echo -e "${CC}你输入的数值$a1不满足以下条件!${RES}"
echo -e "${CC}请输入 {1|2|3|4} 之中的数字!${RES}"
echo -e "${CC}您已输入第$iii次,还有$tg3次输入的机会!${RES}"&& continue
fi
done
expr $a3 + 1 &>/dev/null
if [ $? -eq 0 ];then
if [ $a3 -eq 1 ];then
NAT3=$(ps -ef | grep postfix | grep -v "grep" |wc -l)
expr $NAT3 + 0 &>/dev/null
if [ $? -eq 0 ];then
/bin/ps -ef | grep postfix | grep -v "grep"
echo -e "${CC}查看POSTFIX进程成功!${RES}"
else
echo -e "${CC}查看POSTFIX进程失败!${RES}"
fi
elif [ $a3 -eq 2 ];then
NAT33=$(netstat -tlun | grep "25"| grep "tcp"|wc -l)
expr $NAT33 + 0 &>/dev/null
if [ $? -eq 0 ];then
netstat -tlun | grep "25"| grep "tcp"
echo -e "${CC}查看 POSTFIX 25 号端成功!${RES}"
else
echo -e "${CC}查看 POSTFIX 25 号端口失败!${RES}"
echo -e "${CC}POSTFIX 服务没开起!${RES}"
fi
elif [ $a3 -eq 3 ];then
echo -e "${CC}不好意思,没设POSTFIX安装功能!${RES}"
elif [ $a3 -eq 4 ];then
echo -e "${AA} ======已退出POSTFIX功能菜单界面!======${RES}"
exit
else
echo -e "${CC}您输入的不是 {1|2|3|4} 数字!${RES}"
fi
else
echo -e "${CC}您输入的不是 {1|2|3|4} 数字!${RES}"
fi
}
PD4(){
echo -e "${AA} ==========已退出功能菜单界面!=========${RES}"
exit
}