Easy. Use two scripts at that times, one for enabling and second for disabling. Make sure your time is accurate and don’t use the time from mikrotik ip cloud.
Seeing as you went to the trouble to abstract Guest from ether5, you should call the scripts/scheduler items Disable_Guest and Enable_Guest.
Calling them Disable_ether5 etc. is just stupid and potentially confusing if/when you change the port allocated to “Guest”.
Hard coding IP addresses for NTP is stupid as well, when you’ve just said use pool.ntp.org
@sid5632
You’re entitled to your opinion. But I didn’t change the allocated port. I only added “Guest” as a comment to it, which is what the script works with.
Had it been I changed the port name to “Guest”, it would have made sense for me to name the scheduler “Disable_Guest”. So long as the author of the post understands the script, he can change the comment/name to something else.
Regarding the NTP, I only assumed the poster may need much of those details. I may be wrong on that.
But hey, this is a public forum and we are all here to learn and give back as well. Name calling is really not necessary.
I know you didn’t. I did say if/when it gets changed…
I only added "Guest as comment to it, which is what the script works with.
I know, but it’s vital to the operation, not just some side-issue.
If somebody removed the comment from ether5 and added it to ether4 (say), then everything would still work, but the scheduler/script items would still have a reference in their names to ether5 which is now wrong. You have inadvertently created an unwanted dependency which could be confusing at some point down the line.
Had it been I changed the port name to “Guest”, it would have made sense for me to name the scheduler “Disable_Guest”.
I disagree. The script locates the port by the Comment, not by the port name, so it makes sense to name it as such.
So long as the author of the post understands what the script, he can change the comment/name to something else.
That’s the trouble. Sometimes it is not clear why something has been done the way it has and where/how to change it. Properly naming things can go a long way to reducing confusion and mis-understanding.
As you have it at the moment, if you did change the target ethernet port, then you have several things to change to keep everything consistent. Doing it as I suggested localises the change to just the one place - the place where you are changing the port. You don’t have any other side-effects. This has to be a good thing!
But hey, this is a public forum and we are all here to learn and give back as well. Name calling is really not necessary.
Indeed and I have learnt lots. It was not my intention to name call, and I don’t really believe I did, but rather to try and impart some idea of doing things better, so that others don’t fall in to bad habits when they don’t need to.
Routik, great helpful post! I enjoyed reading it and was not at all disturbed by the HORRIBLE conflict between a comment and code entry item. Overlooking this terrible crime, I give you a big thumbs up!!
If you think the comment is not important, then try changing it to something else and see if the scripts still work.
Then you might understand WHY.
You asked to be educated, but now you only seem to want to be half-educated.
Sometimes I wonder about people. Actually, make that most of the time.
Can you not just admit defeat? You’re wrong or out-of-date. Presumably you are still running some old, bug-ridden, insecure version where this wasn’t implemented (I forget which version introduced it) which is why you’re unaware.
The whole point, as if I need to say it YET again, is that it was NOT unambiguous IF/WHEN things change.
I really fail to see why so many people can’t see this. It’s not arrogance - it’s just being right.
The arrogant ones are those who continually stick their collective heads in the sand and bleat on about how the original was best. It wasn’t.
For the record, server-dns-names option is feature of built-in SNTP client from “system” package. NTP client from “ntp” package doesn’t have it. So you can be both right and save faces if you want. Or unite and hate me for breaking the fight.
Below is my export and you can see I am on the latest version, as per Sob, there seems to be 2 different versions of this NTP, so before you call someone stupid, please confirm which version he was using.
/system ntp client> export
may/24/2018 21:44:19 by RouterOS 6.42.2
software id = XXXXXX
model = 2011UiAS-2HnD
serial number = XXXXXX
/system ntp client
set enabled=yes primary-ntp=196.10.55.57 secondary-ntp=45.222.43.250