From 7f96e5c9669f30cd22914de7f092d009faddf304 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Thu, 18 Apr 2019 10:39:32 +0200 Subject: global-functions: add $WaitForFile, wait for file on fetch The fetch command is asynchronous, the file is not guaranteed to be available when command terminates. I opened an issue at Mikrotik support (Ticket#2019041722004999), their answer: > You should perform a check in a loop. > :delay until file exist > > That can happen also with any configuration not just files. So add a function to wait for a file with given name. I have not seen this with other configuration, though. --- daily-psk.local | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'daily-psk.local') diff --git a/daily-psk.local b/daily-psk.local index 8e22e54..78f7868 100644 --- a/daily-psk.local +++ b/daily-psk.local @@ -9,9 +9,10 @@ :global Identity; :global DailyPskMatchComment; -:global UrlEncode; :global SendNotification; +:global UrlEncode; +:global WaitForFile; :local Seen [ :toarray "" ]; @@ -76,6 +77,7 @@ :do { / tool fetch check-certificate=yes-without-crl \ $Url dst-path=$Attach; + $WaitForFile $Attach; } on-error={ :set Attach ""; } -- cgit v1.2.3-54-g00ecf