Advertisement
Guest User

All this does is fetch a URL and get the hour from it.

a guest
Oct 31st, 2014
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.66 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. hostname="$1"
  4.  
  5. function usage {
  6.         echo "USAGE: $(basename $0) hostname"
  7.         echo
  8.         echo "  hostname: DNS hostname of coldfusion instance to check"
  9.         echo "            expects http://hostname/ssgtime"
  10. }
  11.  
  12. if [ "$hostname" == "" ]; then
  13.         usage
  14.         exit 3
  15. fi
  16.  
  17. remote_hour=$(curl -s "http://${hostname}/ssgtime/")
  18.  
  19. local_hour=$(date +%H)
  20.  
  21. if [ $remote_hour -eq $local_hour ]; then
  22.         echo "OK: Hour of ${remote_hour} on ${hostname} matches enterprise"
  23.         exit 0
  24. else
  25.         echo "CRITICAL: Hour of ${remote_hour} on ${hostname} does not match enterprise ${local_hour}"
  26.         exit 2
  27. fi
  28.  
  29. exit 3
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement