Advertisement
Sergio_Istea

http_monitor-v1.sh

Nov 2nd, 2022
996
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.37 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3.  
  4.  
  5. while :;do
  6.  
  7.     code=$(curl -s -I http://192.168.0.25/descarga.html | grep ^HTTP | cut -d " " -f 2)
  8.  
  9.     if [ ${#code} -eq 0 ];then
  10.         echo "$(date) - response: inalcanzable" >> http_status.log
  11.         sleep 2
  12.         continue
  13.     fi
  14.  
  15.  
  16.     if [[ $code -lt 200 ]] || [[ $code -gt 299 ]];then
  17.         echo "$(date) - response: $code" >> http_status.log
  18.     fi
  19.  
  20.     sleep 2
  21.  
  22.  
  23. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement