How to make web site availability monitoring wia wget with bash and curl
Requied packages: wget,curl.
The first step: create two files:(app.sh,urls.txt).You can make it by run command in terminal:touch app.sh,touch urls.txt .
For making this thing you need create a bash script with next text:
#!/bin/sh
#
# Website monitor script
#
TELEGA_API="telegram api code"
CHAT_ID="chat id"
exec < urls.txt
while read line
do
echo $line
wget --timeout=5 --tries=1 --spider --no-check-certificate ${line}
if [ $? -ne 0 ]; then
curl "https://api.telegram.org/bot${TELEGA_API}/sendMessage?chat_id=${CHAT_ID}&text=${line} - not work"
fi
done