Community discussions

MikroTik App
Siri
刚刚加入了
Topic Author
Posts: 4
加入: Fri Apr 15, 2022 5:11 am

HELP - How to Run a Script Everyday Exact time

Wed May 25, 2022 11:35 am

Hi.
I'm currently running a script that need to be run exact time daily. My schedule setup as follows.
Capture.PNG
the script is running with interval of 1 day. but not exact time as i needed. I need everyday mid night zero or a second pass midnight.


The script run to update a Google Spreadsheet with my daily internet usage data. as you can see below, it delays the update each day by a second or so. 1st day it took 4 seconds & 12 days later now it took 12 seconds.

here my spreadsheet updated time. which is updating each day by adding a second to the schedule time. if this continues, after 60 days the script will run with a minute later.
capp.png
You do not have the required permissions to view the files attached to this post.
Top
用户头像
rextended
Forum Guru
Forum Guru
Posts: 10825
加入: Tue Feb 25, 2014 12:49 pm
Location:Inside the Cat's Eye
Contact:

Re: HELP - How to Run a Script Everyday Exact time

Wed May 25, 2022 12:01 pm

When you disable the scheduler and re-enabled it, it start again at 00:00?

If the script start at 00:00, can't end at 00:00, depending on what the script do.
If the script interact with web, probably some delays happen on remote site...
Top
用户头像
Larsa
Forum Veteran
Forum Veteran
Posts: 818
加入: Sat Aug 29, 2015 7:40 pm
Location:The North Pole, Santa's Workshop

Re: HELP - How to Run a Script Everyday Exact time[SOLVED]

Wed May 25, 2022 12:10 pm

@siri, maybe your clock is drifting. Do you sync the time using NTP?
Top
msatter
Forum Guru
Forum Guru
Posts: 2719
加入: Tue Feb 18, 2014 12:56 am
Location:Netherlands / Nīderlande

Re: HELP - How to Run a Script Everyday Exact time

Wed May 25, 2022 12:12 pm

Register the time Global) when the script completes. Set a delay of 3600 seconds at the start of the script.

Set the start time to 23:00:00

Next day, makes the delay = 3600s-$toredTime (Global)

On reboot/start Global $toredTime is not existing so create a check to set it to 00:00:00 as first in a script.

Ofcourse having a working NTP is important.
Top
Siri
刚刚加入了
Topic Author
Posts: 4
加入: Fri Apr 15, 2022 5:11 am

Re: HELP - How to Run a Script Everyday Exact time

Wed May 25, 2022 1:13 pm

Thank you everyone. as suggest above, it looks like time sync issue. i have checked the router time with my PC time. it has 8 second delay
Top

Who is online

Users browsing this forum:Ahrefs [Bot]and 19 guests

Baidu
map