Advertisement
Guest User

Untitled

a guest
Sep 12th, 2014
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. #!/bin/sh
  2. /usr/bin/samba-tool drs showrepl -d0 2>&1 > /tmp/showrepl
  3.  
  4. dc="DC2"
  5. expected_failure=0
  6. expected_success=20
  7.  
  8. failure=$(grep -c "failed" /tmp/showrepl)
  9. success=$(grep -c "successful" /tmp/showrepl)
  10.  
  11.  
  12. if [ $failure -ne $expected_failure ]; then
  13. cat /tmp/showrepl | mail -s "FAILURE: unexpected showrepl result on $dc" system-status@company.com
  14. echo "failures don't match"
  15. fi
  16.  
  17. if [ $success -ne $expected_success ]; then
  18. cat /tmp/showrepl | mail -s "FAILURE: unexpected showrepl result on $dc" system-status@company.com
  19. echo "successes don't match"
  20. fi
  21.  
  22. if [ $failure -eq $expected_failure ] && [ $success -eq $expected_success ]; then
  23. echo "all is well"
  24. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement