Implementing Commit Scripts
To use a commit script on a router or switch, follow these steps:
- Write the commit script.
For information about the types of commit scripts you can write, see , , and Overview of Creating Custom Configuration Syntax with Macros. For examples, see .
- Copy the script to the
/var/db/scripts/commitdirectory on the hard drive or the/config/scripts/commitdirectory on the flash drive; for information about setting the storage location for scripts, see Storing Commit Scripts in Flash Memory. Only users who belong to the JUNOS super-user login class can access and edit files in these directories.
Note: If the router or switch has dual Routing Engines and you want to enable the commit script to execute on both Routing Engines, you must copy it to the
/var/db/scripts/commitor/config/scripts/commitdirectory on both Routing Engines. The commit synchronize command does not automatically copy scripts between Routing Engines. - Enable the script by including the file filename statement at the [edit system scripts commit] hierarchy level. For instructions, see Controlling Execution of Commit Scripts During Commit Operations.
- Issue the commit command.
The commit script does not execute during this commit operation, but executes automatically during each subsequent commit operation.

