#!/bin/bash
#program:Usingtostudythe[if...then...fi]program
#dsk2007/10/83:00
#content:Iwillusingthisprogramtoshowyousevices
#1.printtheprogram''sworkinyourscreen
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 -ntlp | awk '{print $4}' | grep :80$`
if [ "$www" != "" ];
then
echo $www
echo "WWW is runing"
else
echo $www
echo "WWW is NOT runing"
killall -9 httpd
/usr/sbin/Apachectl start
#service httpd start
fi
#3.ftp
ftp=`netstat -an | grep LISTEN | grep :21`
if [ "$ftp" != "" ]; then
echo $ftp
echo "FTP is runing "
else
echo "FTP is not runing"
killall -9 vsftpd
#service vsftpd start
/etc/init.d/vsftpd start
fi
#4.ssh
ssh=`netstat -ntlp | awk '{print $4}' | grep :22$`
#ssh=`netstat -an | grep LISTEN | grep :22`
if [ "$ssh" != "" ]; then
echo $ssh
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 "Send mail is OK!"
elif [ "$smtp" != "" ] && [ "$pop3" = "" ]; then
echo " Send mail have some problems of your pop3!"
elif [ "$smtp" = "" ] && [ "$pop3" != "" ]; then
echo "Send mail have so me problems of your smtp!"
else
echo "Send mail is NO Trunning!"
fi
关键词标签:Linux
相关阅读
热门文章 安装红帽子RedHat Linux9.0操作系统教程使用screen管理你的远程会话GNU/Linux安装vmware如何登录linux vps图形界面 Linux远程桌面连
人气排行 Linux下获取CPUID、硬盘序列号与MAC地址linux tc实现ip流量限制dmidecode命令查看内存型号linux下解压rar文件安装红帽子RedHat Linux9.0操作系统教程Ubuntu linux 关机、重启、注销 命令lcx.exe、nc.exe、sc.exe入侵中的使用方法查看linux服务器硬盘IO读写负载
查看所有0条评论>>