Guest User

Untitled

a guest
Jul 20th, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.65 KB | None | 0 0
  1. #!/bin/bash
  2. var=$(hostname);
  3. av="Average";
  4. cv="0% packet loss";
  5. htszt="Igen";
  6. str="Nem";
  7.  
  8. function pingAfromB () {
  9. ssh $1 sudo route add -n 10.0.0.0 netmask 255.255.255.0 dev $2
  10. ssh $1 sudo ifconfig $2 $3 netmask 255.255.255.255 up
  11. ssh $4 sudo ifconfig $2 $5 netmask 255.255.255.255 up
  12. myv=$(ssh $1 ping $5 -c1 | grep -B 0 "packet loss"|sed "s/\(.*\)*\(0% packet loss\)\(.*\)/\2/");
  13. if [ "$myv" != "$cv" ]; then
  14. zenity --info --text "Incorrect Link Between C11 - C12";
  15. fi
  16. ssh $1 sudo ifconfig $2 down
  17. ssh $4 sudo ifconfig $2 down
  18.  
  19. }
  20.  
  21. halot=$(zenity  --list  --text "Milyen rész induljon?" --radiolist  --column "Pick" --column "Opinion" TRUE Halozati_teszt FALSE Network_coding FALSE Average);
  22. if [ -n "$halot" ]; then
  23.     if [ "$halot" == "Halozati_teszt" ]; then
  24.         if [ "$var" == "lab29" ]; then
  25.             pingAfromB lab29 eht0 10.0.0.33 lab30 10.0.0.1
  26.             pingAfromB lab29 eht1 10.0.0.22 lab27 10.0.0.29
  27.             pingAfromB lab29 eht2 10.0.0.11 lab26 10.0.0.18
  28.  
  29.             pingAfromB lab28 eht0 10.0.0.30 lab23 10.0.0.2
  30.             pingAfromB lab29 eht1 10.0.0.20 lab25 10.0.0.17
  31.             pingAfromB lab29 eht2 10.0.0.10 lab27 10.0.0.19
  32.  
  33.             pingAfromB lab27 eht0 10.0.0.39 lab24 10.0.0.16
  34.            
  35.             pingAfromB lab24 eht1 10.0.0.36 lab26 10.0.0.28
  36.             pingAfromB lab29 eht2 10.0.0.26 lab25 10.0.0.27
  37.            
  38.             pingAfromB lab26 eht0 10.0.0.38 lab19 10.0.0.3
  39.             pingAfromB lab29 eht0 10.0.0.37 lab21 10.0.0.5
  40.  
  41.             ssh lab19 sudo ifconfig eth0 10.0.0.3 netmask 255.255.255.255 up
  42.             ssh lab21 sudo ifconfig eth0 10.0.0.5 netmask 255.255.255.255 up
  43.             ssh lab23 sudo ifconfig eth0 10.0.0.2 netmask 255.255.255.255 up
  44.             ssh lab30 sudo ifconfig eth0 10.0.0.1 netmask 255.255.255.255 up
  45.         fi
  46.     fi
  47. fi
Add Comment
Please, Sign In to add comment