다음과 같은 스크립트 추가 후,
crontab 에
* * * * * 사용자 실행
추가
#!/bin/sh
HOSTS=”SERVER ADDRESS”
COUNT=1
EMAIL=”EMAIL ADDRESS”
pingtest(){
for myhost in “$@”
do
echo “host ping : $HOSTS”
ping -c “$COUNT” “$HOSTS” -w 5 && return 1
done
return 0
}
pingtest $HOSTS
if [ $? -eq 1 ]
then
#echo “Everyting is fine” | mail -s “Server is OK ” $EMAIL
echo “Everyting is fine”
else
echo “Server ($HOSTS) Pint Test Failed at $(date)” | mail -s “Server is down from KPOPMART DB” $EMAIL
echo “Host ($HOSTS) is down (PING failed) at $(date)”
fi