Hello,
Based on my understanding, you want to run a script when the router turns on, Kindly follow the below steps to achieve the same.
Log in to the Web UI and go to System > Custom Scripts , and then paste the script above "exit 0" as shown below.

Hope this helps.