服务检测脚本

服务检测脚本

#!/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
posted @ 2020-02-16 21:07  jun's  阅读(220)  评论(0编辑  收藏  举报