Community discussions

MikroTik App
 
destr0y
just joined
Topic Author
Posts: 6
Joined: Fri Aug 14, 2009 4:27 am

Scheduling a task to start X mins/hours from now (not interval)

Sun Dec 24, 2017 11:52 am

How do you add a scheduler task to runs a task (once only) in say, one hour from now?
Eg:
/system scheduler add name=okThatsEnoughInternetForToday on-event="/sys script run [find name=\"okThatsEnoughInternetForTodayScript\"]" policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon start-date=[/system clock get date] start-time=[/system clock get time + 1h]  
 
msatter
Forum Guru
Forum Guru
Posts: 2897
Joined: Tue Feb 18, 2014 12:56 am
Location: Netherlands / Nīderlande

Re: Scheduling a task to start X mins/hours from now (not interval)

Sun Dec 24, 2017 12:29 pm

You can include in a script that runs after a hour to deactivate this task. On reboot you have a other task/script that activates this task again with a very long repeat.
 
destr0y
just joined
Topic Author
Posts: 6
Joined: Fri Aug 14, 2009 4:27 am

Re: Scheduling a task to start X mins/hours from now (not interval)

Tue Dec 26, 2017 1:24 am

You can include in a script that runs after a hour to deactivate this task. On reboot you have a other task/script that activates this task again with a very long repeat.
Not quite what I'm chasing, unfortunately. I don't want to run the script now, and again in 60 mins time - I just want to run it once, in 60 mins time. I guess I can always just use the delay command and leave the script running...
 
wirSeefahrer
just joined
Posts: 13
Joined: Tue Jul 26, 2016 12:52 pm

Re: Scheduling a task to start X mins/hours from now (not interval)

Tue Dec 26, 2017 10:08 am

You could create a scheduled task using SSH and generate the due date based on the local clock. Furthermore you have to create another scheduled task the removes the first one let's say 1min after the first one has been executed. Should be fairly straightforward
 
rufo
just joined
Posts: 2
Joined: Fri Jan 21, 2022 10:13 pm

Re: Scheduling a task to start X mins/hours from now (not interval)

Sun Mar 13, 2022 1:28 pm

@wirSeefahrer can you please write example of this
You could create a scheduled task using SSH and generate the due date based on the local clock
, how to set due date 23h 55mins from now?
@destr0y have you done it and how?
Or anybody else?
Thanks in advance
 
User avatar
nEON
just joined
Posts: 8
Joined: Wed Aug 01, 2018 10:09 am
Location: CZ
Contact:

Re: Scheduling a task to start X mins/hours from now (not interval)

Sun Apr 02, 2023 4:29 pm

You can do one-timer @destroy

with interval 00:00:00 means that -> will run just once

example (prepared script named "reb", just don't set interval to make it one-timer):
/system scheduler
add name=upd on-event="sys script run reb" policy=\
    ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon \
    start-date=apr/02/2023 start-time=12:57:50

Who is online

Users browsing this forum: No registered users and 17 guests