daily pastebin goal
45%
SHARE
TWEET

Untitled

a guest Dec 10th, 2018 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2.  
  3. pwd="/srv/scripts"
  4. count=0
  5. echo "Script Started on $(date -u) Failure.Count=$count" >> "$pwd/failures.count"
  6.  
  7. start=start
  8. while [ $start = "start" ]; do
  9.  
  10. sleep 420
  11.  
  12. var=init
  13. var="$(asterisk -rx "pjsip show registrations" | grep -o Registered)"
  14.  
  15.     if [ "$var" != "Registered" ]; then
  16.  
  17.         amportal restart
  18.  
  19.         count=$(( $count + 1 ))
  20.         echo "Trunk Failure on $(date -u) Failure.Count=$count" >> "$pwd/failures.count"
  21.  
  22.     fi
  23.  
  24.  
  25.     if [ "$count" -gt 5 ]; then
  26.  
  27.         echo "Server Reboot due to Failure.Count=$count on $(date -u)" >> "$pwd/reboot.notification"
  28.  
  29.         reboot
  30.  
  31.     fi
  32. done
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top