mirror of
https://github.com/nymurbd/MikroTik-scripts.git
synced 2025-08-31 23:40:28 +02:00
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.
This commit is contained in:
parent
9aac873163
commit
7f96e5c966
5 changed files with 35 additions and 4 deletions
|
@ -10,6 +10,7 @@
|
|||
|
||||
:global SendNotification;
|
||||
:global UrlEncode;
|
||||
:global WaitForFile;
|
||||
|
||||
:local GetIssuerCN do={
|
||||
:foreach IssuerI in=$1 do={
|
||||
|
@ -39,7 +40,9 @@
|
|||
:foreach Type in={ ".pem"; ".p12" } do={
|
||||
:local CertFileName ([ $UrlEncode $CommonName ] . $Type);
|
||||
:do {
|
||||
/ tool fetch check-certificate=yes-without-crl ($CertRenewUrl . $CertFileName);
|
||||
/ tool fetch check-certificate=yes-without-crl \
|
||||
($CertRenewUrl . $CertFileName) dst-path=$CertFileName;
|
||||
$WaitForFile $CertFileName;
|
||||
:foreach PassPhrase in=$CertRenewPass do={
|
||||
/ certificate import file-name=$CertFileName passphrase=$PassPhrase;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue