这个小脚本可以检测WWW,ftp,ssh,sendmail pop3服务是否开启:
#!/bin/bash
#program:Usingtostudythe[if...then...fi]program
#dsk2007/10/83:00
#content:Iwillusingthisprogramtoshowyousevices
#1.printtheprogram''sworkinyourscreen
echo"Now,theserviceofyourLinuxsystemwillbedetect!"
echo"Thewww,ftp,ssh,andsendmail pop3willbedetect!"
echo""
#2.www
www=''netstat-an|grepLISTEN|grep:80''
if["$www"!=""];then
echo"WWWisruning"
else
echo"WWWisNOTruning"
fi
#3.ftp
ftp=''netstat-an|grepLISTEN|grep:21''
if["$ftp"!=""];then
echo"FTPisruning"
else
echo"FTPisnotruning"
fi
#4.ssh
ssh=''netstat-an|grepLISTEN|grep:22''
if["$ssh"!=""];then
echo"SSHisrunning"
else
echo"SSHisnotrunning"
fi
#5.sendmail pop3
smtp=''netstat-an|grepLISTEN|grep:25''
pop3=''netstat-an|grepLISTEN|grep:110''
if["$smtp"!=""]&&["$pop3"!=""];then
echo"SendmailisOK!"
elif["$smtp"!=""]&&["$pop3"=""];then
echo"Sendmailhavesomeproblemsofyourpop3!"
elif["$smtp"=""]&&["$pop3"!=""];then
echo"Sendmailhavesomeproblemsofyoursmtp!"
else
echo"SendmailisNOTrunning!"
fi
Linux下检测是否开启端口脚本Linux下检测是否开启端口脚本Linux下检测是否开启端口脚本Linux下检测是否开启端口脚本Linux下检测是否开启端口脚本Linux下检测是否开启端口脚本Linux下检测是否开启端口脚本Linux下检测是否开启端口脚本Linux下检测是否开启端口脚本Linux下检测是否开启端口脚本
阅读(1746) | 评论(0) | 转发(0) |