服务检测脚本
服务检测脚本
#!/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