Scripting How-To: Committing an Event Script on a Router with Two Routing Engines

by Juniper Employee on ‎03-30-2016 02:23 PM - edited on ‎08-23-2017 11:59 AM by Administrator Administrator (2,009 Views)

To commit an event script on a router with two Routing Engines, ensure that you load the script file on both Routing Engines. A quick way to do this is to use the operational command file copy. For example, if you are on Routing Engine 0 and you copied the script.slax file (throuhg SCP or FTP) into the var/db/scripts/event directory, run the following command:

>file copy /var/db/scripts/event/script.slax re1:/var/db/scripts/event/script.slax

Now you should be able to commit the script.

Remember to repeat the process whenever you change the code; otherwise, after a mastership change you would run an old version of the script!

Mar 31, 2016
Juniper Employee

I would do this differently:

- copy the file in any directory on the router
- use that location as the url, e.g. /var/tmp/script.slax
- file is the name of the file :-), e.g. script.slax
- then use the sync option

user@device-re0> request system scripts refresh-from ?
Possible completions:
commit Refresh commit script from a given base URL
event Refresh event script from a given base URL
file Local script file name
op Refresh op script from a given base URL
*sync* Refresh script and synchronize with other RE
url URL from where the content will be retrieved

user@device-re0> request system scripts refresh-from event sync file
script.slax url /var/tmp/script.slax

This will place the event/op/commit script into the right directories on
both REs.

This should work on Junos 14.1 and later.

However if you add files into /var/db/scripts/event directly, you should
probably executeon each RE:

user@device-re0> request system scripts event-scripts reload