mirror of
https://github.com/wifinigel/MikrotikScripting.git
synced 2025-07-22 11:54:40 +02:00
initial commit
This commit is contained in:
commit
c782dde326
61 changed files with 1457 additions and 0 deletions
18
scripts/ch8-04-foreach-web.rsc
Normal file
18
scripts/ch8-04-foreach-web.rsc
Normal file
|
@ -0,0 +1,18 @@
|
|||
# filename: ch8-04-foreach-web.rsc
|
||||
|
||||
# define an array of web sites
|
||||
:local WebSites {"mikrotik.com"; "google.com"; "twitter.com"};
|
||||
|
||||
# use a foreach loop to check if each site is reachable
|
||||
:foreach Site in=$WebSites do={
|
||||
|
||||
:put "Pinging web site: $Site";
|
||||
|
||||
:local PingResult [/ping $Site count=3 ];
|
||||
|
||||
:if ($PingResult > 0) do {
|
||||
:put ("\nWeb site $Site reached OK\n");
|
||||
} else={
|
||||
:put ("\nNo response from web site: $Site\n");
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue