Hello!
Does anyone have any idea how can a script detect when is the first day of the month?
Thanks,
Radu
Hello!
Does anyone have any idea how can a script detect when is the first day of the month?
Thanks,
Radu
check system date perhaps…
sure I can get the date of the system, but how do I know it is the first day of a month?
I have tried to convert string to integer and then I tried to get the 5th and 6th letter and see if they are equal to “01” but I could not find a working solution.
oct/04/2005
does anyone have any idea?
Hello,
I got this sort of working:
:if ([:pick [/system clock get date] ([:find [/system clock get date] “/” ] + 1) 6 ] = “01”) do={:put “TODAY IS THE FIRST”}
Seems as though scripting engine cannot figure to use string even when in quotes, ie:
:put (“01” & “08”)
cannot compute bitwise “and” of integer number and string
^^ I did not enter an integer - thats why I added quotes.
or
:put [:tonum “08”]
outputs nothing because its confused by a leading 0.
So maybe above solution will be a workaround?
Sam
I tried it and it seems to work. Thanks a lot!!!
Hi there! I have to say it was a pretty interesting topic. I experienced the exact same problem years ago writing software in Turbo Pascal. I tried to make a nice big clock, but had to convert the clock (think it was in string form) to integer, and there was no way but to use if functions.
If I may ask, why do you need to know the first day of the month? Are you trying to cap clients or something, and reset the cap again on the first?
Regards, Giepie
Well, my clients have a monthly allotted quota of traffic. To keep them happy, after they finish their quota, they are moved into another profile which gives them unlimited traffic but heavily limited bandwidth. I have scripts that supervise for that.
Naturally I wanted at the first of every month the counters to be reset and the users should be again allocated their quota and bandwidth. Which now works very nicely. If someone is interested in the scripts and schedulers, I will post them.
By the way, I also have the following scripts:
Regards,
Radu
Bogdane It will be friendly, if you send them here so we can use somewhere in our networks.
I already posted a few here:
http://forum.mikrotik.com//viewtopic.php?t=4738
If you need the others too, let me know.