Guest User

Untitled

a guest
Dec 10th, 2018
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  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
Add Comment
Please, Sign In to add comment