Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- pwd="/srv/scripts"
- count=0
- echo "Script Started on $(date -u) Failure.Count=$count" >> "$pwd/failures.count"
- start=start
- while [ $start = "start" ]; do
- sleep 420
- var=init
- var="$(asterisk -rx "pjsip show registrations" | grep -o Registered)"
- if [ "$var" != "Registered" ]; then
- amportal restart
- count=$(( $count + 1 ))
- echo "Trunk Failure on $(date -u) Failure.Count=$count" >> "$pwd/failures.count"
- fi
- if [ "$count" -gt 5 ]; then
- echo "Server Reboot due to Failure.Count=$count on $(date -u)" >> "$pwd/reboot.notification"
- reboot
- fi
- done
Add Comment
Please, Sign In to add comment