Page 1 of 1

startup script

Posted: Mon May 19, 2014 3:53 pm
by Beelze
Following script runs at startup. Everything works, except the part where i resolve www.google.nl and where it should run the next script.
When i run it from the CLI, the whole script works.

Any suggestions?
#define global variables
       :global resolveThis "www.google.nl"
       :global test
       :global serverfile test.conf
       :global importfile import.conf
       
       #create configscript
       /system script add name=import-conf source="
           /tool fetch \\
               address=test.com \\ 
               src-path=$serverfile \\
               user=admin \\
               mode=https \\
               password=pass! \\ 
               dst-path=$importfile \\
               port=443 keep-result=yes \n
           /system script add name=$importfile source=[/file get $importfile contents]
           /system script run $importfile \n
       "
       
       #connect to the internet, then run script
       :local continue true
       
       while ($continue) do={
       [/ip dns cache flush]
           
           :set test [:resolve $resolveThis]
           
           :if ($test != "") do={
               /system script run import-conf
               :set continue false
           }
       }

Re: startup script

Posted: Mon May 19, 2014 4:41 pm
by Beelze
It seems like the while loop is ignored and the statements in that scope aren't executed when I schedule the script at startup.

Re: startup script

Posted: Mon May 19, 2014 5:27 pm
by Beelze
I think I found the problem. I defined the continue variable as :local instead of :global.