以检测WWW,ftp,ssh,sendmail + pop3服务是否开启
2011-09-08 11:18
483 查看
转自:http://hi.baidu.com/richardlee007/blog/item/fab7a145f832a422cefca377.html
这个小脚本可以检测WWW,ftp,ssh,sendmail + pop3服务是否开启:
#!/bin/bash
#program: Using to study the [ if ... then ... fi ] program
#dsk 2007/10/8 3:00
#content: I will using this program to show you sevices
#1. print the program's work in your screen
echo "Now, the service of your Linux system will be detect!"
echo "The www, ftp,ssh,and sendmail + pop3 will be detect!"
echo " "
#2. www
www='netstat -an|grep LISTEN|grep :80'
if [ "$www" != "" ]; then
echo "WWW is runing"
else
echo "WWW is NOT runing"
fi
#3. ftp
ftp='netstat -an|grep LISTEN|grep :21'
if [ "$ftp" != "" ]; then
echo "FTP is runing"
else
echo "FTP is not runing"
fi
#4. ssh
ssh='netstat -an|grep LISTEN|grep :22'
if [ "$ssh" != "" ];then
echo "SSH is running"
else
echo "SSH is not running"
fi
#5. sendmail + pop3
smtp='netstat -an|grep LISTEN|grep :25'
pop3='netstat -an|grep LISTEN|grep :110'
if [ "$smtp" != "" ] && [ "$pop3" != "" ]; then
echo "Sendmail is OK!"
elif [ "$smtp" != "" ] && [ "$pop3" = "" ]; then
echo "Sendmail have some problems of your pop3!"
elif [ "$smtp" = "" ] && [ "$pop3" != "" ]; then
echo "Sendmail have some problems of your smtp!"
else
echo "Sendmail is NOT running!"
fi
这个小脚本可以检测WWW,ftp,ssh,sendmail + pop3服务是否开启:
#!/bin/bash
#program: Using to study the [ if ... then ... fi ] program
#dsk 2007/10/8 3:00
#content: I will using this program to show you sevices
#1. print the program's work in your screen
echo "Now, the service of your Linux system will be detect!"
echo "The www, ftp,ssh,and sendmail + pop3 will be detect!"
echo " "
#2. www
www='netstat -an|grep LISTEN|grep :80'
if [ "$www" != "" ]; then
echo "WWW is runing"
else
echo "WWW is NOT runing"
fi
#3. ftp
ftp='netstat -an|grep LISTEN|grep :21'
if [ "$ftp" != "" ]; then
echo "FTP is runing"
else
echo "FTP is not runing"
fi
#4. ssh
ssh='netstat -an|grep LISTEN|grep :22'
if [ "$ssh" != "" ];then
echo "SSH is running"
else
echo "SSH is not running"
fi
#5. sendmail + pop3
smtp='netstat -an|grep LISTEN|grep :25'
pop3='netstat -an|grep LISTEN|grep :110'
if [ "$smtp" != "" ] && [ "$pop3" != "" ]; then
echo "Sendmail is OK!"
elif [ "$smtp" != "" ] && [ "$pop3" = "" ]; then
echo "Sendmail have some problems of your pop3!"
elif [ "$smtp" = "" ] && [ "$pop3" != "" ]; then
echo "Sendmail have some problems of your smtp!"
else
echo "Sendmail is NOT running!"
fi
相关文章推荐
- 检测网站是否开启SSH服务
- Ubuntu查看ssh服务是否开启
- Solaris系统中关闭和开启系统服务ftp,telnet,ssh,sendmail
- 下列服务使用的默认端口:ftp,ssh,telnet,dhcp,mail,pop3,smtp,dns,http,sm
- 查看linux虚拟机ssh服务是否开启
- Ubuntu 开启FTP和SSH服务
- 自动检测apache服务是否开启
- ubutn中开启ssh服务以及开启ftp服务
- Linux下检测FTP服务并开启FTP服务
- 开启 SSH服务,及FTP 工具 乱码问题
- linux 查看ip和开启ssh,ftp服务
- Ubuntu开启SSH服务(相应的openssh安装)& FTP服务(相应的vsftpd安装)
- Linux下检测FTP服务并开启FTP服务
- 用Telnet命令检测邮件服务器SMTP及POP3服务通信是否正常
- linux as4 虚拟机 上开启 telnet 和ssh 和 ftp 服务
- bat定时检测系统服务是否开启
- android检测某个服务是否开启
- Android 检测服务是否开启的方法
- 写一个服务,隔5分钟检测一次,某一个进程,是否启动,如果没有启动,则开启进程
- solaris系统中关闭和开启系统服务ftp,telnet,ssh,sendmail