arunk786

topology

Dec 13th, 2011
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. topology.sh
  2.  
  3. #!/bin/bash
  4. while [ $# -gt 0 ] ; do
  5. nodeArg=$1
  6. exec< /home/hduser/scripts/topology.data
  7. result=""
  8. while read line ; do
  9. ar=( $line )
  10. if [ "${ar[0]}" = "$nodeArg" ] ; then
  11. result="${ar[1]}"
  12. fi
  13. done
  14. shift
  15. if [ -z "$result" ] ; then
  16. echo -n "/default-rack "
  17. else
  18. echo -n "$result "
  19. fi
  20. done
  21.  
  22. topology.data
  23.  
  24. 10.0.1.97 /dc1/rack1
  25. 10.0.1.55 /dc1/rack2
  26.  
Advertisement
Add Comment
Please, Sign In to add comment