Difference between revisions of "ECMP Failover Script"

From MikroTik Wiki
Jump to: navigation, search
m
m (Reverted edits by NilCbx (Talk); changed back to last version by Atis)
Line 1: Line 1:
[http://benevolently.freehostia.com/content/view/olympus-mini/ olympus mini s] [http://saline-joy.freehostia.com/web/porno-na.htm porno na web] [http://scaleslea.freewebpage.org/text/directory/perle-veneziane/ perle veneziane] [http://zoelverd.freeweb7.com/description/lib/duca-enrico/ duca enrico] [http://scaleslea.freewebpage.org/text/directory/panche-bilanciere/ panche bilanciere] [http://www.freewebtown.com/boogiejames/topic/www-webmotors.htm www webmotors] [http://greensticky.freehostia.com/library/html/max-sito/ max sito ufficiale] [http://greensticky.freehostia.com/library/html/va-pensiero/ va pensiero nabucco] [http://greensticky.freehostia.com/library/html/market-ingross/ market ingross] [http://saline-joy.freehostia.com/web/que-es.htm que es creatividad] [http://licohwar.homeblock.com/library/html/traduzione-della/ traduzione della canzone try di nelly fu] [http://getm0ney.freewebpage.org/lib/loredana-berte/ loredana berte in alto mare] [http://mauballe.125mb.com/web/sigla-buffy/ sigla buffy scarica] [http://licohwar.homeblock.com/library/html/ariston-frigoriferi/ ariston frigoriferi monoporta] [http://saline-joy.freehostia.com/web/guerra-libica.htm guerra libica 1911 1912] [http://getm0ney.freewebpage.org/lib/tappetino-dance/ tappetino dance] [http://zoelverd.freeweb7.com/description/lib/flaibano/ flaibano] [http://gawelzba.t35.com/library/html/telefoni-filo.htm telefoni filo] [http://kopapguw.homeblock.com/topic/caraoke/ caraoke] [http://gawelzba.t35.com/library/html/romero.htm romero] [http://licohwar.homeblock.com/library/html/polsat-keys/ polsat keys] [http://failtoexpress.freehostia.com/html/richard-stallman.htm richard stallman] [http://lorcaxon.homeblock.com/data/colonna-sonora/ colonna sonora gost] [http://wainfan.t35.com/view/new/loireatlantique.htm loire-atlantique] [http://zoelverd.freeweb7.com/description/lib/sei-speciale/ sei speciale] [http://scaleslea.freewebpage.org/text/directory/nerorgasmo-nerorgasmo/ nerorgasmo nerorgasmo] [http://www.freewebtown.com/starbriteyellow/resources/articles/hard-disk.htm hard disk 2 5 60gb 8mb 5400rpm] [http://beshennayabelka.freehostia.com/content/view/bottomley-gordon.htm bottomley, gordon] [http://lorcaxon.homeblock.com/data/opel-/ opel    vectra 2.0 16v t di 4p. sport] [http://saline-joy.freehostia.com/web/cross-country.htm cross country] [http://kopapguw.homeblock.com/topic/merica-merica/ merica merica] [http://mcwardlo.t35.com/library/html/that-i/ that i would be good] [http://huruple.125mb.com/text/directory/ww-eamon/ ww eamon it] [http://saline-joy.freehostia.com/web/tarom.htm tarom] [http://huruple.125mb.com/text/directory/telecomando-canon/ telecomando canon eos 300d] [http://failtoexpress.freehostia.com/html/studio-emme.htm studio emme] [http://licohwar.homeblock.com/library/html/la-signora/ la signora e i suoi mariti] [http://zoelverd.freeweb7.com/description/lib/alyssia-west/ alyssia west baby got boobs] [http://getraylo.freeweb7.com/img/styles/tony-d.htm tony d aloia] [http://grahrens.125mb.com/view/new/barcellona-libri/ barcellona libri] [http://www.freewebtown.com/starbriteyellow/resources/articles/wilkins-sir.htm wilkins, sir george hubert] [http://www.freewebtown.com/prncessprncipe/library/html/toshiba-slim.htm toshiba slim] [http://licohwar.homeblock.com/library/html/mistonocivo/ mistonocivo] [http://gawelzba.t35.com/library/html/acer-pro.htm acer pro] [http://selemku.t35.com/text/directory/www-freindster.htm www freindster com] [http://saline-joy.freehostia.com/web/cra.htm c.r.a.] [http://boreldar.t35.com/text/directory/angel-boris.htm angel boris] [http://coarmago.t35.com/content/view/ef-/ ef 400 is] [http://failtoexpress.freehostia.com/html/logitech-thx.htm logitech thx] [http://mauballe.125mb.com/web/sms-gratis/ sms gratis dal pc] [http://beshennayabelka.freehostia.com/content/view/finanziamento-sevilla.htm finanziamento sevilla] [http://grahrens.125mb.com/view/new/casio-digital/ casio digital] [http://greensticky.freehostia.com/library/html/novita-pc/ novita pc portatili] [http://scaleslea.freewebpage.org/text/directory/un-sito/ un sito ufficiale europeo per il nintendo ds] [http://wainfan.t35.com/view/new/punto-.htm punto 5 porte] [http://failtoexpress.freehostia.com/html/firmware-xcam.htm firmware xcam] [http://scaleslea.freewebpage.org/text/directory/francesca-dominatrice/ francesca dominatrice] [http://saline-joy.freehostia.com/web/un-buon.htm un buon inizio 2001 per tdk] [http://coarmago.t35.com/content/view/ekaterinoslav/ ekaterinoslav] [http://selemku.t35.com/text/directory/levigare-marmo.htm levigare marmo] [http://grahrens.125mb.com/view/new/chitarra-elettrica/ chitarra elettrica custodia] [http://selemku.t35.com/text/directory/peugeot-.htm peugeot 206 a scoppio] [http://failtoexpress.freehostia.com/html/pokidat.htm pokidat] [http://benevolently.freehostia.com/content/view/supporto-auto/ supporto auto pda mitac mio 168] [http://licohwar.homeblock.com/library/html/i-leoni/ i leoni di pietroburgo] [http://lorcaxon.homeblock.com/data/dsc-t/ dsc t3 sony] [http://getm0ney.freewebpage.org/lib/mini-john/ mini john cooper works] [http://saline-joy.freehostia.com/web/lettori-audio.htm lettori audio] [http://benevolently.freehostia.com/content/view/maglietta-nba/ maglietta nba] [http://coarmago.t35.com/content/view/un-grano/ un grano regno sicilia] [http://huruple.125mb.com/text/directory/techno-warriors/ techno warriors] [http://lorcaxon.homeblock.com/data/video-nokia/ video nokia] [http://oedi.freehostia.com/text/directory/maschio-o/ maschio o femmina] [http://licohwar.homeblock.com/library/html/commento-alle/ commento alle fronde dei salici] [http://wainfan.t35.com/view/new/zooma.htm zooma] [http://getraylo.freeweb7.com/img/styles/foto-boys.htm foto boys] [http://saline-joy.freehostia.com/web/logitech-cordless.htm logitech cordless desktop lx500] [http://grahrens.125mb.com/view/new/side-by/ side by general electric] [http://failtoexpress.freehostia.com/html/sisi-srl.htm si-si srl] [http://scaleslea.freewebpage.org/text/directory/per-vivere/ per vivere insieme] [http://beshennayabelka.freehostia.com/content/view/meteo-verona.htm meteo verona] [http://grahrens.125mb.com/view/new/registratore-mini/ registratore mini disc portatile] [http://oedi.freehostia.com/text/directory/www-gianni/ www gianni celeste it] [http://failtoexpress.freehostia.com/html/tv-color.htm tv color 14 pollici] [http://flheddin.125mb.com/content/view/le-cinque.htm le cinque equazioni che hanno cambiato] [http://wainfan.t35.com/view/new/rex-.htm rex 22 10 fa] [http://failtoexpress.freehostia.com/html/stampante-laser.htm stampante laser hp color] [http://benevolently.freehostia.com/content/view/sigillo/ sigillo] [http://selemku.t35.com/text/directory/cinese-solitario.htm cinese solitario] [http://benevolently.freehostia.com/content/view/pictures/ pictures] [http://wainfan.t35.com/view/new/www-petarde.htm www petarde] [http://zoelverd.freeweb7.com/description/lib/marica-giannini/ marica giannini] [http://grahrens.125mb.com/view/new/gta/ g.t.a] [http://www.freewebtown.com/prncessprncipe/library/html/fotos-de.htm fotos de xuxa nua] [http://oedi.freehostia.com/text/directory/immagini-di/ immagini di john lennon] [http://kopapguw.homeblock.com/topic/graduatoria-universita/ graduatoria universita uninsubria varese] [http://wainfan.t35.com/view/new/tuscany-villa.htm tuscany villa] [http://coarmago.t35.com/content/view/ospedale-bollate/ ospedale bollate] [http://huruple.125mb.com/text/directory/tcc-/ tcc 8 e] [http://www.freewebtown.com/starbriteyellow/resources/articles/dragom-ball.htm dragom ball] [http://grahrens.125mb.com/view/new/eleni-vitali/ eleni vitali] [http://failtoexpress.freehostia.com/html/obiettivi-k.htm obiettivi k] [http://oedi.freehostia.com/text/directory/radeon-xxt/ radeon x850xt platinum] [http://boreldar.t35.com/text/directory/crostata-marmellata.htm crostata marmellata] [http://www.freewebtown.com/boogiejames/topic/www-squadron.htm www squadron com] [http://scaleslea.freewebpage.org/text/directory/lodate/ lodate] [http://saline-joy.freehostia.com/web/speed-racer.htm speed racer] [http://failtoexpress.freehostia.com/html/music-school.htm music school] [http://mauballe.125mb.com/web/thunder-tiger/ thunder tiger uno] [http://benevolently.freehostia.com/content/view/monitor-sony/ monitor sony 23 lcd] [http://coarmago.t35.com/content/view/olympus-fotocamera/ olympus fotocamera digitale mju-mini] [http://scaleslea.freewebpage.org/text/directory/guerra-santa/ guerra santa il corano martiri] [http://mauballe.125mb.com/web/michel-vith/ michel vith] [http://selemku.t35.com/text/directory/contatori.htm contatori] [http://getm0ney.freewebpage.org/lib/toyota-/ toyota 4 runner] [http://lorcaxon.homeblock.com/data/chamotte/ chamotte] [http://greensticky.freehostia.com/library/html/kaleidoscopia/ kaleidoscopia] [http://mauballe.125mb.com/web/mappa-svizzera/ mappa svizzera] [http://selemku.t35.com/text/directory/globet-tv.htm globet tv] [http://www.freewebtown.com/starbriteyellow/resources/articles/monte-grappa.htm monte grappa] [http://oedi.freehostia.com/text/directory/bic-ruga/ bic ruga] [http://huruple.125mb.com/text/directory/mokia/ mokia 6680] [http://grahrens.125mb.com/view/new/aspettando-la/ aspettando la notte] [http://wainfan.t35.com/view/new/accessori-passeggino.htm accessori passeggino graco] [http://boreldar.t35.com/text/directory/joao-pessoa.htm joao pessoa] [http://www.freewebtown.com/prncessprncipe/library/html/hoppner.htm hoppner] [http://beshennayabelka.freehostia.com/content/view/lettori-cd.htm lettori cd lenco] [http://zoelverd.freeweb7.com/description/lib/volo-rozzano/ volo rozzano] [http://boreldar.t35.com/text/directory/gunrun.htm gunrun] [http://scaleslea.freewebpage.org/text/directory/thermaltake-shark/ thermaltake shark black] [http://getm0ney.freewebpage.org/lib/spiderman/ spiderman3] [http://grahrens.125mb.com/view/new/canoa-kayak/ canoa kayak] [http://www.freewebtown.com/starbriteyellow/resources/articles/sony-gb.htm sony gb] [http://failtoexpress.freehostia.com/html/ufficio-bussolengo.htm ufficio bussolengo] [http://greensticky.freehostia.com/library/html/traformare-midi/ traformare midi in wav] [http://flheddin.125mb.com/content/view/wwe-giocattoli.htm wwe giocattoli] [http://beshennayabelka.freehostia.com/content/view/gigabyte-kt.htm gigabyte kt600] [http://wainfan.t35.com/view/new/canon-ef.htm canon ef 90-300mm f 4 5-5] [http://saline-joy.freehostia.com/web/fornace-trento.htm fornace (trento)] [http://getraylo.freeweb7.com/img/styles/speed-cross.htm speed cross] [http://scaleslea.freewebpage.org/text/directory/sientelo-mp/ sientelo mp3] [http://www.freewebtown.com/prncessprncipe/library/html/farmacie-roma.htm farmacie roma] [http://flheddin.125mb.com/content/view/pensionata.htm pensionata] [http://huruple.125mb.com/text/directory/risacca/ risacca] [http://getraylo.freeweb7.com/img/styles/dolce-gabbana.htm dolce gabbana slip uomo] [http://getm0ney.freewebpage.org/lib/dj-ross/ dj ross] [http://selemku.t35.com/text/directory/foto-raoul.htm foto raoul bova] [http://lorcaxon.homeblock.com/data/clipart-scuola/ clipart scuola] [http://lorcaxon.homeblock.com/data/ragazzo-alghero/ ragazzo alghero] [http://selemku.t35.com/text/directory/rio-dos.htm rio dos elefantes] [http://beshennayabelka.freehostia.com/content/view/assicurazione-autocarro.htm assicurazione autocarro] [http://boreldar.t35.com/text/directory/canon-dc.htm canon dc52] [http://wainfan.t35.com/view/new/wd-scorpio.htm wd scorpio] [http://grahrens.125mb.com/view/new/aspire-living/ aspire living center] [http://scaleslea.freewebpage.org/text/directory/tom-clacy/ tom clacy s] [http://getraylo.freeweb7.com/img/styles/win-d.htm win 4d singapore] [http://mauballe.125mb.com/web/pentax-digitale/ pentax digitale optio 30] [http://beshennayabelka.freehostia.com/content/view/film-pubblicitari.htm film pubblicitari - produzione e realizzazione] [http://saline-joy.freehostia.com/web/nuova-mini.htm nuova mini one verde] [http://oedi.freehostia.com/text/directory/bg-sites/ bg sites] [http://getraylo.freeweb7.com/img/styles/disco-fisso.htm disco fisso] [http://www.freewebtown.com/boogiejames/topic/ibero.htm ibero-] [http://zoelverd.freeweb7.com/description/lib/km-suzuki/ km0 suzuki gpl auto km 0] [http://licohwar.homeblock.com/library/html/eros-ramazzotti/ eros ramazzotti cuori agitati] [http://getm0ney.freewebpage.org/lib/amico-di/ amico di colore] [http://lorcaxon.homeblock.com/data/ristorante-portico/ ristorante portico del seminario] [http://saline-joy.freehostia.com/web/www-calendario.htm www calendario anna valle it] [http://wainfan.t35.com/view/new/convocazione.htm convocazione] [http://gawelzba.t35.com/library/html/oem-atx.htm oem atx] [http://wainfan.t35.com/view/new/trama-di.htm trama di sherlock holmes] [http://zoelverd.freeweb7.com/description/lib/codici-sblocco/ codici sblocco telefonini] [http://coarmago.t35.com/content/view/via-di/ via di qua] [http://www.freewebtown.com/prncessprncipe/library/html/luomo-ragno.htm luomo ragno premiato da sony] [http://benevolently.freehostia.com/content/view/prenotazione-hotel/ prenotazione hotel canazei] [http://selemku.t35.com/text/directory/m.htm m603] [http://mauballe.125mb.com/web/bodybuilding-video/ bodybuilding video] [http://kopapguw.homeblock.com/topic/nicoleta-lucio/ nicoleta lucio] [http://licohwar.homeblock.com/library/html/impianti-chimici/ impianti chimici] [http://scaleslea.freewebpage.org/text/directory/www-mediawordl/ www mediawordl] [http://saline-joy.freehostia.com/web/barhgn-oregon.htm bar122hgn oregon] [http://selemku.t35.com/text/directory/testo-every.htm testo every body is changing] [http://saline-joy.freehostia.com/web/locali-noturni.htm locali noturni] [http://coarmago.t35.com/content/view/mobil-phone/ mobil phone] [http://www.freewebtown.com/prncessprncipe/library/html/bobble-boom.htm bobble boom] [http://flheddin.125mb.com/content/view/puerto-rico.htm puerto rico hurricane] [http://lorcaxon.homeblock.com/data/dlink-dwlg/ d-link dwl-g] [http://saline-joy.freehostia.com/web/mathias.htm mathias] [http://zoelverd.freeweb7.com/description/lib/porno-harry/ porno harry potter] [http://huruple.125mb.com/text/directory/home-based/ home based business opportunity] [http://failtoexpress.freehostia.com/html/campbell-david.htm campbell, david] [http://www.freewebtown.com/starbriteyellow/resources/articles/perle-di.htm perle di ghiaccio] [http://grahrens.125mb.com/view/new/dvd-ornella/ dvd ornella vanoni] [http://wainfan.t35.com/view/new/groove-com.htm groove com] [http://selemku.t35.com/text/directory/canzoni-sarde.htm canzoni sarde] [http://huruple.125mb.com/text/directory/pistero/ pistero] [http://beshennayabelka.freehostia.com/content/view/incontri-a.htm incontri a fermo] [http://flheddin.125mb.com/content/view/hardt-ernst.htm hardt, ernst] [http://failtoexpress.freehostia.com/html/programmi-scolastici.htm programmi scolastici] [http://mcwardlo.t35.com/library/html/prove-di/ prove di maturita] [http://www.freewebtown.com/boogiejames/topic/condizionatore-aria.htm condizionatore aria] ==See also==
+
==See also==
 
*[[MikroTik RouterOS]]
 
*[[MikroTik RouterOS]]
  
Line 52: Line 52:
  
 
     / system script  
 
     / system script  
     add name="ecmp-startup" source=":if \(\[/ping 1.1.1.12 count=1\]=1
+
     add name="ecmp-startup" source=":if \(\[/ping 1.1.1.12 count=1\]=1 && \
 +
    \[/ping 1.1.1.13 count=1\]=1 && \[/ip route get \[find \
 +
    comment=\"ECMP Route For HTTP\"\] disabled\]=true\) do={ :log info \"Both gateways up" \
 +
    \n/ip route set \[find routing-mark=ecmp-http-route\] \
 +
    disabled=no}" policy=ftp,reboot,read,write,policy,test,winbox,password
 +
    add name="ecmp-shutdown" source=":if \(\[/ping 1.1.1.12 count=1\]=1 && \
 +
    \[/ping 1.1.1.13 count=1\]=0\) do={ :log info \"Gateway down"\
 +
    \n/ip route set \[find routing-mark=ecmp-http-route\] \
 +
    disabled=yes}" policy=ftp,reboot,read,write,policy,test,winbox,password
 +
 
 +
    Hi I found this error while trying to use this script, what worked for me was
 +
    ecmp start/shut script. Looks like  in the start and shut script (") are missing
 +
    from the find, well other the script works wonders for me. Thanks a lot savagedavid
 +
 
 +
    ecmp starthp script
 +
    :if ([/ping 1.1.1.13 count=1]=1 && [/ping 1.1.1.12 count=1]=1 && [/ip route get \
 +
    [find routing-mark="ecmp-http-route"] disabled]=true) do={:log info "Both Gateways are up" \
 +
    /n/ip route set [find routing-mark="ecmp-http-route"] disable=no}
 +
 
 +
    ecmp shutdown script
 +
    :if ([/ping 1.1.1.13 count=1]=0 || [/ping 1.1.1.12 count=1]=0) do={:log info \
 +
    "Gateway down" /ip route set [find routing-mark="ecmp-http-route"] disabled=yes}
 +
 
 +
 
 +
Notice that it first checks to see if the route is enable before trying to re-enable it. Otherwise it will reset the route and users will be dropped momentarily.
 +
 
 +
Then finally schedule the scripts to check every 30 seconds:
 +
 
 +
    / system scheduler
 +
    add name="gateway-check" on-event="/system script run ecmp-shutdown
 +
    script run ecmp-startup" start-date=jan/01/1970 start-time=00:00:00 \
 +
    interval=30s comment="" disabled=no
 +
 
 +
Happy scripting!
 +
savagedavid
 +
 
 +
[[Category: Routing]]

Revision as of 10:25, 13 August 2007

See also

How to do automatic ECMP failover


This script demonstrates one method of doing automatic failover using the Netwatch function and using scripting to enable or disable gateways. This is probably not the most efficient way, but it works. I would welcome any input on how it can be improved.

The situation:

You have 2 lines going out to the internet - 10.0.0.12 and 10.0.0.13. You have setup a mangle to mark HTTP traffic (optional) and want to route http along the 2 lines using load balancing.

You setup the mangle:

   /ip firewall mangle add chain=prerouting protocol=tcp dst-port=80 action=mark-routing \
   new-routing-mark=ecmp-http-route passthrough=yes comment=" Route HTTP \
   traffic to ECMP" disabled=no 

You set up ECMP (Equal Cost Multipath Routing) by using something like

   /ip route add dst-address=0.0.0.0/0 gateway=10.0.0.12,10.0.0.13 routing-mark=ecmp-http-route comment="ECMP route for HTTP"

Now you have ECMP for HTTP only. This is nice because MSN messenger, banking websites and other programs and problem sites will not be broken in the same way it might be if you used ECMP for all protocols.

What I then do is for example mark SMTP traffic and route this out through 10.0.0.12:

   /ip firewall mangle add chain=prerouting protocol=tcp dst-port=25 action=mark-routing \
   new-routing-mark=smtp-out passthrough=yes comment="SMTP Traffic" disabled=no 
   /ip route add dst-address=0.0.0.0/0 gateway=10.0.0.12 routing-mark=smtp-out comment="SMTP Traffic out"

and route all other traffic through 10.0.0.13

   /ip route add dst-address=0.0.0.0/0 gateway=10.0.0.13 comment="Default Route to Internet"

Then I need to setup 2 routes to specific addresses to force the router through specific gateways to "test" the links. These should not be popular addresses with your users! Otherwise when a gateway goes down they will have no access to those sites. The addresses I am using as an example are 1.1.1.12 to test 10.0.0.12, and 1.1.1.13 to test 10.0.0.13.

Next I use the Netwatch Function to switch all traffic to the working gateway should any of the gateways fail:

   / tool netwatch 
   add host=1.1.1.13 timeout=2s interval=30s up-script="/ip route set \
   \[find comment=\"Default Route To Internet\"\] gateway=10.0.0.13" \
   down-script="/ip route set \[find comment=\"Default Route To Internet\"\] \
   gateway=10.0.0.12 comment="" disabled=no 
   add host=1.1.1.12 timeout=2s interval=30s up-script="/ip route set \
   \[find comment=\"SMTP Traffic out\"\] gateway=1.0.0.12" down-script="/ip \
   \n" \route set \[find comment=\"SMTP Traffic out\"\] gateway=10.0.0.13
   comment="" disabled=no 

The problem is that the ECMP http route will still be active, therefore http traffic wont work, so I have 2 scripts to check if both gateways are up or down and take action accordingly:

   / system script 
   add name="ecmp-startup" source=":if \(\[/ping 1.1.1.12 count=1\]=1 && \
   \[/ping 1.1.1.13 count=1\]=1 && \[/ip route get \[find \
   comment=\"ECMP Route For HTTP\"\] disabled\]=true\) do={ :log info \"Both gateways up" \
   \n/ip route set \[find routing-mark=ecmp-http-route\] \
   disabled=no}" policy=ftp,reboot,read,write,policy,test,winbox,password 
   add name="ecmp-shutdown" source=":if \(\[/ping 1.1.1.12 count=1\]=1 && \
   \[/ping 1.1.1.13 count=1\]=0\) do={ :log info \"Gateway down"\
   \n/ip route set \[find routing-mark=ecmp-http-route\] \
   disabled=yes}" policy=ftp,reboot,read,write,policy,test,winbox,password
   Hi I found this error while trying to use this script, what worked for me was
   ecmp start/shut script. Looks like  in the start and shut script (") are missing
   from the find, well other the script works wonders for me. Thanks a lot savagedavid
   ecmp starthp script
   :if ([/ping 1.1.1.13 count=1]=1 && [/ping 1.1.1.12 count=1]=1 && [/ip route get \
   [find routing-mark="ecmp-http-route"] disabled]=true) do={:log info "Both Gateways are up" \
   /n/ip route set [find routing-mark="ecmp-http-route"] disable=no}
   ecmp shutdown script
   :if ([/ping 1.1.1.13 count=1]=0 || [/ping 1.1.1.12 count=1]=0) do={:log info \
   "Gateway down" /ip route set [find routing-mark="ecmp-http-route"] disabled=yes} 


Notice that it first checks to see if the route is enable before trying to re-enable it. Otherwise it will reset the route and users will be dropped momentarily.

Then finally schedule the scripts to check every 30 seconds:

   / system scheduler 
   add name="gateway-check" on-event="/system script run ecmp-shutdown
   script run ecmp-startup" start-date=jan/01/1970 start-time=00:00:00 \
   interval=30s comment="" disabled=no

Happy scripting! savagedavid