SHARE
TWEET

Untitled

a guest Sep 16th, 2019 101 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #The goal of this script is to run the test digs on an RDNS server, and, given
  2. #success, reinitialize gateway services.
  3.  
  4. #!/bin/bash
  5. set -o nounset
  6. die() {
  7.   echo "$0" 1>&2 && exit 1;
  8. }
  9.  
  10. digs= /usr/local/resolververify/testdigs.sh
  11. #There are a total of 18 test digs. We're hoping they all pass here.  
  12. if [[ $(timeout 4 $digs | grep -c "NOERROR") -eq 18 ]];
  13.   then echo "digs look good, chap. putting node back in prod";
  14.  
  15. #This finds the statuses of our services before attempting to start them.
  16.   $(ps aux | grep -v grep | grep -q bgpd);
  17.   bgpd_running=$?
  18.   $(ps aux | grep -v grep | grep -q zebra);
  19.   zebra_running=$?
  20.  
  21.     if !$bgpd_running \
  22.     then sudo /sbin/service bgpd start \
  23.     $bgpd_running=$?
  24.       else die "Something didn't work or bgpd's already running." \
  25.     fi;
  26.  
  27.     if $bgpd_running && !$zebra_running;
  28.     then sudo /sbin/service zebra start
  29.       else die "Something didn't work or zebra's already running."
  30.     fi;
  31.  
  32. else die "didn't work, buddy"
  33. fi
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