Community discussions

MikroTik App
 
jacbizer
just joined
Topic Author
Posts: 1
Joined: Tue May 11, 2021 8:31 am

Scheduling script to enable / disable Netwatch

Tue May 11, 2021 11:32 am

Anyone knows the scheduling script to disable and enable netwatch?
I tried /tool netwatch disable [find host=8.8.8.8] but it doesn't work... appreciate your help.
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3279
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: Scheduling script to enable / disable Netwatch

Wed May 12, 2021 10:47 am

This work fine on my router.
[test] /tool netwatch> /tool netwatch disable [find host=8.8.8.8]
[test] /tool netwatch> print
Flags: X - disabled
 #   HOST                 TIMEOUT              INTERVAL             STATUS  SINCE
 0 X 8.8.8.8              998ms                10s                  unknown may/12/2021 09:46:08
[test] /tool netwatch> /tool netwatch enable  [find host=8.8.8.8]
[test] /tool netwatch> print
Flags: X - disabled
 #   HOST                 TIMEOUT              INTERVAL             STATUS  SINCE
 0   8.8.8.8              998ms                10s                  up      may/12/2021 09:46:22
print shows X when its disabled. So 0 X 8.8.8.8 vs 0 8.8.8.8
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11967
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Scheduling script to enable / disable Netwatch

Wed May 12, 2021 12:07 pm

Anyone knows the scheduling script to disable and enable netwatch?
I tried /tool netwatch disable [find host=8.8.8.8] but it doesn't work... appreciate your help.

/tool netwatch disable [find where disabled=no and host=8.8.8.8]
...
/tool netwatch enable [find where disabled=yes and host=8.8.8.8]
And... yes, someone can ask "Why check if already are disabled?"
My reply is simple: as programmer I prefer to double ckeck, because sometimes unexpected behaviors happen....

RouterOS version?

/tool netwtch export

and put results on forum

Who is online

Users browsing this forum: JDF and 16 guests