#!/bin/bash
fulldate=`date +%y-%m-%d\ %H:%M:%S`
justdate=$(date +%Y-%m-%d)
log=/client_chk/IP-${justdate}.log
mkdir -p /client_chk/
token="API_TOKEN"
id="chat_ID"
domain_chk=$(curl -s -o /dev/null -w "%{http_code}\n" https://도메인)
domain_chk=$(curl -s https://도메인)
if [ "${domain_chk}" == "200" ]; then
echo "Non Issue" >> $log
else
echo "${fulldate} 체크 실패!!!" >> $log
echo "텔레그램 발송" >> $log
curl -s -X POST "https://api.telegram.org/bot${token}/sendMessage?" \
-d "chat_id=${id}" \
-d "text=상태 값: ${domain_chk} !!! "
fi