Community discussions

MikroTik App
 
xbar7networks
just joined
Topic Author
Posts: 9
Joined: Sun Feb 18, 2018 4:47 pm

Scheduler not working

Sun Feb 18, 2018 11:26 pm

I am trying to have a simple queue activated w/ one set of tx/rx values during the day and another at night. This seems very straight forward according to the instructions and examples at these sites:

https://wiki.mikrotik.com/wiki/Manual:Scripting
https://wiki.mikrotik.com/wiki/Manual:S ... g-examples

I have created a script to enable one queue and disable the other in the morning and another script to enable/disable in opposite fashion at night. Both scripts work fine when executed from the
cli. This is easily verified by confirming the 2 queues are set the the expected enable/disable values after running. Also the scheduler reports that the run-count is increasing so the scheduled jobs appear to be executed.

The problem is that the scheduler does not seem to execute either script since after it reports it has run (run count increments by one) there is no change to the state of the queues.

I will give a brief description of the design and then show the configuration, followed by some output showing the results of the manual job run etc.

RouterOS version 6.40.5.

[rtr] /system scheduler> export
# feb/18/2018 07:19:28 by RouterOS 6.40.5
# software id = BKWB-V892
#
# model = RouterBOARD 952Ui-5ac2nD

I created a system scheduler named 'Day' and 'Night'
Each executes 1 time / day and on-event is set to a script named the same, i.e. 'Day' & 'Night'


[rtr] /system scheduler
[rtr] /system scheduler> export
add interval=1d name=Day on-event=Day policy=read,write start-date=feb/16/2018 start-time=06:00:00
add interval=1d name=Night on-event=Night policy=read,write start-date=feb/16/2018 start-time=16:00:00


The system scripts are named 'Day' and 'Night'

Each is a job to enable one simple queue and disable the other. Simple queues are named 'Day' & 'Night'

[rtr] /system script> export

/system script
add name=Night owner=xb7 policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source=\
"/queue simple enable Night; /queue simple disable Day"
add name=Day owner=xb7 policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source=\
"/queue simple enable Day; /queue simple disable Night"


Queues are created with names 'Day' & 'Night'

[rtr] /system script> /queue simple
[rtr] /queue simple> export

/queue simple
add disabled=yes max-limit=20M/20M name=Day target=192.168.10.0/24
add max-limit=3M/5M name=Night target=192.168.10.0/24

The system clock is set correctly and ntp-client is configured correctly and verified as working (updating regularly).

Output below shows the scheduled jobs have been run once each but each time I checked the state of the queues and found them not to be as expected, that is nothing was changed.

Output showing the scheduled jobs and run-counts.

[rtr] /system scheduler> print
Flags: X - disabled
# NAME START-DATE START-TIME INTERVAL ON-EVENT RUN-COUNT
0 Day feb/16/2018 06:00:00 1d Day 1
1 Night feb/16/2018 16:00:00 1d Night 1

Output showing the current state of the queues (before running the jobs manually from cli).

[rtr] /system script> /queue simple print
Flags: X - disabled, I - invalid, D - dynamic
0 XI name="Day" target=192.168.10.0/24 parent=none packet-marks="" priority=8/8 queue=default-small/default-small limit-at=0/0
max-limit=20M/20M burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s bucket-size=0.1/0.1

1 name="Night" target=192.168.10.0/24 parent=none packet-marks="" priority=8/8 queue=default-small/default-small limit-at=0/0
max-limit=3M/5M burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s bucket-size=0.1/0.1


Day is disabled, Night is enabled.

Now run the Day script manually and again look at the state of the queues

[rtr] /system script> run Day
[rtr] /system script> /queue simple print
Flags: X - disabled, I - invalid, D - dynamic
0 name="Day" target=192.168.10.0/24 parent=none packet-marks="" priority=8/8 queue=default-small/default-small limit-at=0/0
max-limit=20M/20M burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s bucket-size=0.1/0.1

1 XI name="Night" target=192.168.10.0/24 parent=none packet-marks="" priority=8/8 queue=default-small/default-small limit-at=0/0
max-limit=3M/5M burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s bucket-size=0.1/0.1

Note that Day is now enabled and Night is disabled.

Now run the Night job from cli and show the state of the queues.

[xb7@rtr] /system script> run Night
[xb7@rtr] /system script> /queue simple print
Flags: X - disabled, I - invalid, D - dynamic
0 XI name="Day" target=192.168.10.0/24 parent=none packet-marks="" priority=8/8 queue=default-small/default-small limit-at=0/0
max-limit=20M/20M burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s bucket-size=0.1/0.1

1 name="Night" target=192.168.10.0/24 parent=none packet-marks="" priority=8/8 queue=default-small/default-small limit-at=0/0
max-limit=3M/5M burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s bucket-size=0.1/0.1


Night is enabled and Day is disabled.
 
whitestargh
newbie
Posts: 28
Joined: Tue Feb 08, 2011 2:48 pm

Re: Scheduler not working

Thu Feb 22, 2018 4:08 pm

I can confirm same on ros 6.41 running on 3011UiAS

Script runs perfectly on clie (/system script run scriptname)
And although scheduler counter increases the script does not run.

both script and scheduler have policy=ftp,read,write,policy,test,password,sensitive,romon

The script is shown below. It basically updates a dynamic public ip address on dny.dn.he.net and update a gre interface local-address
Same script run on ros 6.40.3

#This a script to update gre interface ip
:global ddnshost "www.example.com"
:global key "testing123"
:global updatehost "dyn.dns.he.net"
:global greinterface "gre0"
:global WANinterface "pppoe-out1"

:local outputfile2 "dyndns.txt"
:local previousip
:local currentip
:log info ("#### Running dyndns-script.sh ####")

:set previousip [:resolve "www.example.com" ]
:set currentip [/ip address get [/ip address find interface=$WANinterface] address]
:set currentip [:pick [:tostr $currentip] 0 [:find [:tostr $currentip] "/"]]

:log info ("previous ip = $previousip")
:log info ("current ip = $currentip")
:if ($currentip = $previousip) do={
\t:log info ("IP has not changed, no update necessary");
\t[/file remove $outputfile2];
\t} else={
\t:log info ("Updating dyndns for ... " . $currentip . "...");
\t[/tool fetch mode=https user=$ddnshost password=$key url="https://$ddnshost:$key@$updatehost/nic/update?hostname=$ddnshost&myip=$currentip" dst-path=$outputfile2];
\t[/interface gre set $greinterface local-address=$currentip];
\t:log info ([/file get $outputfile2 contents]);
\t[/file remove $outputfile2];
\t}
 
jerryroy1
Member Candidate
Member Candidate
Posts: 168
Joined: Sat Mar 17, 2007 4:55 am
Location: LA and OC USA
Contact:

Re: Scheduler not working

Thu Feb 22, 2018 9:50 pm

I have a simple ping script used to initiate IPsec tunnel from a dynamic IP site that is not working in 6.40.5. Did you ever receive a solution?
 
xbar7networks
just joined
Topic Author
Posts: 9
Joined: Sun Feb 18, 2018 4:47 pm

Re: Scheduler not working

Tue Apr 24, 2018 7:56 am

I have a simple ping script used to initiate IPsec tunnel from a dynamic IP site that is not working in 6.40.5. Did you ever receive a solution?

Jerryroy1 - no reply from MT support. Not the first time. Great products, great price, terrible support. I guess you get what you pay for...
 
jerryroy1
Member Candidate
Member Candidate
Posts: 168
Joined: Sat Mar 17, 2007 4:55 am
Location: LA and OC USA
Contact:

Re: Scheduler not working

Wed Jul 18, 2018 9:52 pm

What I have found to work is to duplicate the script (use the copy command when you open original) and name it something different. Then point your scheduler or a new scheduler at the new script. For some reason it does not like to run against the original name. This only happens sometimes as we have hundreds of these devices deployed. Very odd behavior.

Who is online

Users browsing this forum: No registered users and 64 guests