Advertisement
Guest User

Mikrotik Version Test 6.41

a guest
Jun 22nd, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. :global version [/system resource get version ]
  2. :local vMajor;
  3. :local vMinor;
  4.  
  5. # split the version apart so you can compare them
  6. :for i from=0 to=([:len $myVer] - 1) do={
  7. :if ( [:pick $myVer $i] = ".") do={
  8. :set vMajor [:tonum [:pick $myVer 0 $i]];
  9. :set vMinor [:tonum [:pick $myVer ($i + 1) [:len $myVer]]] ;
  10. }
  11. }
  12.  
  13. :log info "RouterOs version is $vMajor.$vMinor";
  14.  
  15. # now do the compare and change it to easy to use variable
  16. :if ($vMajor < 4) do={
  17. #check minor version
  18. :if ($vMinor >= 41) do={
  19. :global vtest = 1;
  20. } else={
  21. :global vtest = 0;
  22. }
  23. } else={
  24. :log warning "Router Os version is not a 4.0 branch it is $vMajor.$vMinor, config script is not compatible;
  25. }
  26.  
  27. # now the vtest variable can be used each time you need to change based on version
  28.  
  29. :if ($vtest = 1) do={
  30. /ip neighbor discovery-settings set discover-interface-list=LAN;
  31. } else={
  32. /ip neighbor discovery set 0 discover=no;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement