Community discussions

MikroTik App
 
ArnisRukis
just joined
Topic Author
Posts: 2
Joined: Tue Jul 05, 2016 12:13 am

Netwatch script and global variables - BUG or Feature?

Tue Mar 02, 2021 4:53 pm

RouterOS 6.48.1
#Script1(Set all needed variables):
:global OnClock 8:30:00
:global OffClock 16:30:00

#Script2 in Netwatch:
:if ([/system resource get uptime]>900) do={:log info "No ping";  /system script run Script3;}

#Script3(called from Netwatch):
:global OnClock
:global OffClock
:log info $OnClock
:log info $OffClock
Script1 and Script3 has Don`t require Permissions option.
Script3 runs manually without any problem.
If netwatch event occur - global variables in Script3 are logged as blank. Without "Don`t require Permissions option" in Script3 I get error "could not run script Script3: not enough permissions"

I don`t want to put "Global" variable value in each script where it is needed.

This is BUG or "feature"?
How to resolve this issue?
 
ykleet
newbie
Posts: 29
Joined: Thu Oct 17, 2019 11:29 am

Re: Netwatch script and global variables - BUG or Feature?

Thu Apr 08, 2021 3:52 pm

Try this:

:execute "/system script run Script3"

Who is online

Users browsing this forum: Bing [Bot] and 15 guests