Autoexec

Hi all,

is it possible (I didn’t find) to run script after the system boot’s up? I’m running RouterOS with watchdog and I want to know when the system reboots due to failure.

sure, try the following:

/system script add name=bootup source={
   :local upt; :set upt [/system resource get uptime]
   :local runc; :set runc [/system scheduler get run run-count]
   :if (($upt<61s)&&($runc<=1)) do={
        /tool send to=name@domain.com subject="Router has rebooted!"
    }
}

/system scheduler add name=run interval=1m on-event=bootup disabled=no

I think in v2.9 there will be such a setting that will let you to accomplish this in easier way.

Edgars

Thanks for fast answer. I hope there will be easier way.

I have another idea, using netwatch watching router’s IP address. It will trigger the “up” action after startup but never fail :slight_smile:. I just wanted know, if does exist eaiser way… Thanks…

now RouterOS support event “startup”, use the scheduler like:

/system scheduler
add name=on-startup policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon start-time=startup \
    on-event=":delay 60s;# after initial delay for give time to start all services, insert what you want do here"

Wow, you are digging deep and find some very a threads: 2004 :slight_smile:

If somone search.. find :slight_smile: