Action Timed Out only on startup, not subsequent runs of script

I get a script error only when running a script during startup. When it runs on a scheduled run after, it is fine. The error is:

script,error router atl: script error: action timed out - try again, if error continues contact MikroTik support and send a supout file (13)

The script is as follows:

:local maticuser "user"
:local maticpass "pass"
:local matichost "host"
:local currentIPFile disk1/dnsomatic-current-ipv4.txt
:local logFile disk1/dnsomatic-log.txt

:global dnsomaticPreviousIP

:log info "DNSoMatic: fetching current IP"

:do {
  /tool fetch url="http://myip.dnsomatic.com/" mode=http dst-path=$currentIPFile
} on-error={ :local error "DNSoMatic: failed to get IP"; :log error $error; :error $error }

:local currentIP [/file get $currentIPFile contents]

:if ($currentIP != $dnsomaticPreviousIP) do={
  :log info "DNSoMatic: new=$currentIP, old=$dnsomaticPreviousIP, trying update"

  :do {
    /tool fetch url="http://updates.dnsomatic.com/nic/update\3Fmyip=$currentIP&wildcard=NOCHG&mx=NOCHG&backmx=NOCHG&hostname=$matichost" user=$maticuser password=$maticpass mode=http dst-path=$logFile
  } on-error={ :local error "DNSoMatic: failed to update"; :log error $error; :error $error }

  :log info ("DNSoMatic: response: " . [/file get $logFile contents])
  :log info "DNSoMatic: new=$currentIP, old=$dnsomaticPreviousIP"
  :set dnsomaticPreviousIP $currentIP
} else={
  :log info "DNSoMatic: no change"
}

This runs on as schedule from startup and every 15 minutes. I’ve tried a delay of 30s, 5m, etc but it will still error out the first time and only the first time.

It always times out at the fetch line, it does log this right before:

  :log info "DNSoMatic: new=$currentIP, old=$dnsomaticPreviousIP, trying update"

It does not hit my error catch.

Any ideas on how to make this script work on startup with erroring?

Seems to be related to disk1, I formatted the disk as ext3 and it is fine now. Odd.

Hey

I think that the IP stack may not be ready yet when this script is run, either internally or externally.

I thought that as well, but with a :delay 15 or so that covers that just fine.

The issue was truly the disk1 issue, if I store the file on the internal storage or after formatting, it worked fine. How odd!

Good to know, thx