bobbai 发表于 2018-8-20 07:33:51

每日一shell(四)检测主机存活

#!/bin/bash  ip='192.168.0.19'
  mail=aiker@gzedu.ml
  while true
  do
  ping -c4 $ip> /dev/null
  if [ $? -ne 0 ]
  then
  echo "`date +%F-%T` $ip is down" | mail -s " $ip is down" $mail
  fi
  sleep 30
  done

页: [1]
查看完整版本: 每日一shell(四)检测主机存活