I've been asked to come up with a method to change hotspot passwords on a weekly basis.
I've been using a script which does this on a monthly basis.
My concern here is that mikrotik's system clock doesn't seem to keep track of weeks, so how would I then use that as a variable in my script?
Has anyone else deployed something like this before?
Keep in mind we don't use user manager or a radius server.
Below is the working script I use currently to change hotspot password monthly.
:local date [/system clock get date]
:local month [:pick $date 0 3]
:local day [:pick $date 4 6]
:local year [:pick $date 7 11]
:if ($month = "jan") do={
/ip hotspot user set user1 password="CASS01";
/sy sche set HotspotCodeChange start-date=("feb/01/" . $year);}
:if ($month = "feb") do={
/ip hotspot user set user1 password="CASS02";
/sy sche set HotspotCodeChange start-date=("mar/01/" . $year);}
:if ($month = "mar") do={
/ip hotspot user set user1 password="CASS03";
/sy sche set HotspotCodeChange start-date=("apr/01/" . $year);}
:if ($month = "apr") do={
/ip hotspot user set user1 password="CASS04";
/sy sche set HotspotCodeChange start-date=("may/01/" . $year);}
:if ($month = "may") do={
/ip hotspot user set user1 password="CASS05";
/sy sche set HotspotCodeChange start-date=("jun/01/" . $year);}
:if ($month = "jun") do={
/ip hotspot user set user1 password="CASS06";
/sy sche set HotspotCodeChange start-date=("jul/01/" . $year);}
:if ($month = "jul") do={
/ip hotspot user set user1 password="CASS07";
/sy sche set HotspotCodeChange start-date=("aug/01/" . $year);}
:if ($month = "aug") do={
/ip hotspot user set user1 password="CASS08";
/sy sche set HotspotCodeChange start-date=("sep/01/" . $year);}
:if ($month = "sep") do={
/ip hotspot user set user1 password="CASS09";
/sy sche set HotspotCodeChange start-date=("oct/01/" . $year);}
:if ($month = "oct") do={
/ip hotspot user set user1 password="CASS10";
/sy sche set HotspotCodeChange start-date=("nov/01/" . $year);}
:if ($month = "nov") do={
/ip hotspot user set user1 password="CASS11";
/sy sche set HotspotCodeChange start-date=("dec/01/" . $year);}
:if ($month = "dec") do={
/ip hotspot user set user1 password="CASS12";
:set year ($year + 1);
/sy sche set HotspotCodeChange start-date=("jan/01/" . $year);}
Please let me know of any possiblities.