Is there any way to tell if an rsc file is being imported from the terminal using the “import” command, or by using the “Run After Reset” feature of the “Reset Configuration” tool?
The only thing I can come up with right now is using uptime, but that’s not very accurate.
A script ran by “Run After Reset” feature should find an empty configuration (no ip address, no system identity, etc.).
I have myself an initialization script that will run only if it considers the box has default settings. I test for no ip address (other than eventually 192.168.88.1/24), and default system identity :
# A box is considered unconfigured if system identity name is the default "MikroTik" and
# it has no ip address or only the default 192.168.88.1/24 .
if ( ( [/system identity get name] = "MikroTik" ) and \
( [:len [/ip address find where address!="192.168.88.1/24"] ] = 0 ) \
) do={
:log warning "This box is brand new. Configuring it !"
# ADD ANY CODE YOU WISH
}
Thanks, but I already have similar code in my script. This only tells me if the router config is clean though - not if it’s running from terminal or using the “run after reset” feature, which is what I need to know. Any other ideas?