It’s probably going to be better if you use a random password generator, such as those in this topic (e.g. the one that’s entirely self sufficient in the router).
But if you insist on having the passwords pre generated…
I suggest you write them out as a global variable, perhaps one that’s auto imported on startup (to make sure it’s all OK in case of power failure). Then also have a secondary variable that starts at 0 and is incremented daily, after the password is changed with the one indicated.
In other words, run the following
/file print file="pass.txt";
/file set "pass.txt" contents="0";
:delay 2s;
/system scheduler add name=REGISTER_WPA start-time=startup on-event={
:global wpaPasswords ({
"OGNERKSZGL";
"LGZSKRNGO";
...
});
:global wpaPassword [:tonum [/file get "pass.txt" contents]];
};
/system scheduler add name=CHANGE_WPA interval=1d on-event={
:local newPassword [:pick $wpaPasswords $wpaPassword];
/interface wireless security-profiles set "default" wpa-pre-shared-key="$newPassword" wpa2-pre-shared-key="$newPassword";
:set wpaPassword ($wpaPassword + 1);
:if ($wpaPassword >= [:len $wpaPasswords]) do={
:set wpaPassword 0;
}
/file set "pass.txt" contents="$wpaPassword";
};
And reboot your router (or “manually” run REGISTER_WPA).
This will be a lot more efficient than the alternative you’re proposing. If you were to parse an entire file, then every day, the script would take quite a while, and will probably peak your CPU during the time of the password change. The approach above only has a more serious impact on startup (which presumably will happen rarely, since this is a router), after which it’s as efficient as the “post parsing” phase of the alternative. The whole “parsing” part is the heavy thing that’s eliminated here.