服务检测脚本

服务检测脚本

#!/bin/bash
for i in {mysql,nginx,ssh}
do
   if [ `ps aux |grep $i |wc -l` -lt 2 ];then
      echo "`date "+%F %T"`--$i is not run" | tee -a /var/log/check_service.log
   else 
      echo "`date "+%F %T"`--$i is running" | tee -a /var/log/check_service.log
   fi  
done
原文地址:https://www.cnblogs.com/CoolMark-blog/p/12318741.html