判断linux下的网络服务是否正常启动
作者 佚名技术
来源 Linux系统
浏览
发布时间 2012-05-14
# 自动判断samba,http,named,dovecot,tomcat等服务是否正常启动
#
#作者:胡昌文
#时间:2008-09-28
#MSN:hucw_rhce@hotmail.com
#
#
#!/bin/sh SAMBA1=`netstat -nutlp | grep :137 | grep smbd` SAMBA2=`netstat -nutlp | grep :138 | grep smbd` SAMBA3=`netstat -nutlp | grep :139 | grep smbd` SAMBA4=`netstat -nutlp | grep :445 | grep smbd` SAMBA=$SAMBA1$SAMBA2$SAMBA3$SAMBA4 if [ "$SAMBA" ]; then echo -e "Checking samba services...... [ 33[32mOK33[m ]" else echo -e "Checking samba services...... [ 33[31mNG33[m ]" fi APACHE=`netstat -nutlp | grep :80 | grep httpd` if [ "$APACHE" ]; then echo -e "Checking httpd services...... [ 33[32mOK33[m ]" else echo -e "Checking httpd services...... [ 33[31mNG33[m ]" fi SMTP=`netstat -nutlp | grep :25 | grep master` if [ "$SMTP" ]; then echo -e "Checking smtpd services...... [ 33[32mOK33[m ]" else echo -e "Checking smtpd services...... [ 33[31mNG33[m ]" fi POP3=`netstat -nutlp | grep :110 | grep dovecot` if [ "$POP3" ]; then echo -e "Checking dovecot services...... [ 33[32mOK33[m ]" else echo -e "Checking dovecot services...... [ 33[31mNG33[m ]" fi MYSQL=`netstat -nutlp | grep :3306 | grep mysql` if [ "$MYSQL" ]; then echo -e "Checking mysqld services...... [ 33[32mOK33[m ]" else echo -e "Checking mysqld services...... [ 33[31mNG33[m ]" fi NAMED=`netstat -nutlp | grep :53 | grep named` if [ "$NAMED" ]; then
echo -e "Checking named services...... [ 33[32mOK33[m ]" else echo -e "Checking named services...... [ 33[31mNG33[m ]" fi JAVA=`netstat -nutlp | grep 8080 | grep java` if [ "$JAVA" ]; then echo -e "Checking tomcat services...... [ 33[32mOK33[m ]" else echo -e "Checking tomcat services...... [ 33[31mNG33[m ]" fi
|
||
凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢! |
你可能对下面的文章感兴趣
上一篇: 修改perl CPAN模块安装的配置文件下一篇: NTPserver配置实例
关于判断linux下的网络服务是否正常启动的所有评论