summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoranweshadas <anwesha@das.community>2022-05-09 08:57:10 +0200
committeranweshadas <anwesha@das.community>2022-05-09 08:57:10 +0200
commit43bef83d905d2ecf127684715ee7b1dda9124c87 (patch)
treee4b4828ee4617b97f0e6264fea8f0f31e0cf8936
parent848a1ad7ebb7a0da65724d56a66a272053619e2d (diff)
Adds the to do and dig and ping
-rw-r--r--monitor.sh7
1 files changed, 5 insertions, 2 deletions
diff --git a/monitor.sh b/monitor.sh
index 39d9b6e..c7573a6 100644
--- a/monitor.sh
+++ b/monitor.sh
@@ -10,9 +10,12 @@ echo $url #this is for testing purpose. To be removed in thhe final code.
if [[ "$http_code" != 200 ]]; then
echo Fatal. $url is down. status_code $http_code
domain_name=$(echo $url | awk -F[/:] '{print $4}')
- echo domain=$domain_name
- dig_response=$(dig $domain_name)
+ echo $domain_name
+ # 1. Find IP address via dig
+ # 2. Check if we can ping the ip address
+ ip_address=$(dig +short $domain_name)
echo $dig_response #this is for testing purpose. To be removed in thhe final code.
+ ping_response=$(ping $ip_address)
else
echo $url is working. status_code $http_code
fi