Hello everyone. I'm trying to get the following scenario working on SXT LTE kit device:
1) Scheduler runs "failoverScript" every 3 minutes. If current SIM has no internet access, SIM card is switched.
2) Scheduler runs "backtomain" script every 60 minutes to check whether SIM A (main) or SIM B (backup) is in use. If SIM B is active, try switching to SIM A, ping some resource, and switch back to SIM B in case of failure. If everything works, stay on SIM A.
As I'm not experienced with Mikrotik devices and never had to deal with the scripts, I tried adapting solutions that seem to be most closely related to my needs (namely Dual SIM Application and Improved Netwatch).
The first part of my task, "failoverScript" works as intended, no problems there. However I'm struggling to get "backtomain" to work.
As there's no obvious way of debugging scripts, I added log outputs for debugging (lines 30, 32, 35 and 38 of "backtomain"). I'm only getting the log output for line 30, but nothing after that seems to work. Tested every bit individually, there should be no problems with conditions or anything, and that same bit of code works fine in another script.
Not chasing perfection here, so the code is a bit cluttered. My sole goal is to get it working as intended. Could anyone please point out what's wrong with my second script?
P.S. The IP addresses used for checking connectivity are there just as an example.