监控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
注:写时千万注意空格
本文转自linux博客51CTO博客,原文链接http://blog.51cto.com/yangzhiming/842308如需转载请自行联系原作者
yangzhimingg