监控fms的脚本

# vi fms.sh
 
#!/bin/bash

Port=`netstat -ntpl | grep fmsadmin | grep -v "11110" | awk -F[:" "]+ '{print $5}'`
if [[ $Port == "1111" ]];then
echo "fms is running at time:`date +%y/%m/%d-%H:%M`" >> /usr/local/apache/logs/fms.log
else
echo "fms is down at time:`date +%y/%m/%d-%H:%M`" >> /usr/local/apache/logs/fms.log
service fms restart
fi
 

 
:wq
 
 
注:写时千万注意空格