Community discussions

MikroTik App
 
rae
newbie
Topic Author
Posts: 33
Joined: Fri Jul 04, 2014 5:17 pm

Schedule for 1st of every month

Fri Jul 11, 2014 5:39 pm

Is it possible to setup a schedule to run on the 1st of every month?
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11967
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Schedule for 1st of every month

Fri Jul 11, 2014 5:42 pm

FASSSSSSSSSSSSSSSSST RESPONSE:

Not directly.

Run one script each midnight and if day=01 execute the rest of the script

:if ([/system clock get date]~"/01/") do={
#place instructions here
};

Ohhhhhh... Near everytime I solve one problem for another user, I give some new idea... thanks mikrotik forum...
 
rae
newbie
Topic Author
Posts: 33
Joined: Fri Jul 04, 2014 5:17 pm

Re: Schedule for 1st of every month

Sat Jul 12, 2014 12:07 pm

Thanks, I'll give it a whirl. :)
 
projectdimpreza
just joined
Posts: 2
Joined: Thu Jul 11, 2019 6:37 pm

Re: Schedule for 1st of every month

Thu Sep 12, 2019 12:15 pm

FASSSSSSSSSSSSSSSSST RESPONSE:

Not directly.

Run one script each midnight and if day=01 execute the rest of the script

:if ([/system clock get date]~"/01/") do={
#place instructions here
};

Ohhhhhh... Near everytime I solve one problem for another user, I give some new idea... thanks mikrotik forum...
im new to scripting.. and this is one of my problem.. can u show me a script to run every 9th of the month.. then.. disable a specific ppp secret user.. then if its active .. delete it from active ppp connection?
 
marting
Member Candidate
Member Candidate
Posts: 172
Joined: Thu Aug 21, 2014 2:07 pm

Re: Schedule for 1st of every month

Thu Sep 12, 2019 1:44 pm

/system scheduler
add interval=1d name=disableUserSecrets on-event=":local usersToDisable [:toarray \"martin, thomas\"]\r\
    \n:local dayToDisable \"09\"\r\
    \n\r\
    \n:if ( [ :pick [ /system clock get date ] 4 6  ] = \$dayToDisable ) do={\r\
    \n    :foreach user in \$usersToDisable do {\r\
    \n        :log info \"disabling ppp secret '\$user' and killing active connections\"\r\
    \n        /ppp secret disable [ find name=\$user ]\r\
    \n        /ppp active remove [ find name=\$user ]\r\
    \n    }\r\
    \n}" policy=read,write start-date=jan/01/2019 start-time=00:00:01
 
savage
Forum Guru
Forum Guru
Posts: 1262
Joined: Mon Oct 18, 2004 12:07 am
Location: Cape Town, South Africa
Contact:

Re: Schedule for 1st of every month

Thu Sep 12, 2019 3:38 pm

:if ([/system clock get date]~"/01/") do={
#place instructions here
};
Wouldn't that also run every day on the first month?
 
marting
Member Candidate
Member Candidate
Posts: 172
Joined: Thu Aug 21, 2014 2:07 pm

Re: Schedule for 1st of every month

Fri Sep 13, 2019 2:00 pm

No, output is like this:
[martin@het-ro-a] > :put [ /system clock get date ]               
sep/13/2019
 
vinmagall
just joined
Posts: 2
Joined: Thu Oct 27, 2022 6:10 pm

Re: Schedule for 1st of every month

Sun Apr 30, 2023 8:30 pm

/system scheduler
add interval=1d name=disableUserSecrets on-event=":local usersToDisable [:toarray \"martin, thomas\"]\r\
    \n:local dayToDisable \"09\"\r\
    \n\r\
    \n:if ( [ :pick [ /system clock get date ] 4 6  ] = \$dayToDisable ) do={\r\
    \n    :foreach user in \$usersToDisable do {\r\
    \n        :log info \"disabling ppp secret '\$user' and killing active connections\"\r\
    \n        /ppp secret disable [ find name=\$user ]\r\
    \n        /ppp active remove [ find name=\$user ]\r\
    \n    }\r\
    \n}" policy=read,write start-date=jan/01/2019 start-time=00:00:01
This is what im looking for how can i execute this with specific time? like i want to execute this every 7:00:00 in the morning. thank you so much
 
Renaldi
just joined
Posts: 2
Joined: Thu Jun 01, 2023 2:58 am

Re: Schedule for 1st of every month

Thu Jun 01, 2023 3:00 am

:local datetime [/system clock get date];
:put $datetime;
:if ($datetime~"/01/") do={
:set $datetime "Hari ini tanggal 01";
} else={
:set $datetime "Bukan Tanggal 01"
};

:put $datetime
Last edited by Renaldi on Thu Jun 01, 2023 3:00 am, edited 1 time in total.
 
Renaldi
just joined
Posts: 2
Joined: Thu Jun 01, 2023 2:58 am

Re: Schedule for 1st of every month

Thu Jun 01, 2023 4:04 am

Maybe that's what you need
Last edited by Renaldi on Thu Jun 01, 2023 4:06 am, edited 1 time in total.

Who is online

Users browsing this forum: Bing [Bot], ccrsxx and 64 guests