Implementing Event Scripts

This section provides directions for using event scripts on a device running Junos OS.

Installing Event Scripts on a Device Running Junos OS

To install event scripts on a device running Junos OS, follow these steps:

  1. Write the event script. For information about writing event scripts, see Writing Event Scripts. For event script examples, see Event Script Examples.
  2. Copy the script to the /var/db/scripts/event directory on the hard drive or the /config/scripts/event directory on the flash drive. For information about setting the storage location for scripts, see Storing Event Scripts in Flash Memory. Only users who belong to the Junos OS super-user login class can access and edit files in these directories.

    Note: If the device has dual Routing Engines and you want to enable the event script to execute on both Routing Engines, you must copy the script to the /var/db/scripts/event or /config/scripts/event directory on both Routing Engines. The commit synchronize command does not automatically copy scripts between Routing Engines.

  3. Enable the script by including the file filename statement at the [edit event-options event-script] hierarchy level. For instructions, see Enabling an Event Script.
  4. Issue the commit command.

After the commit operation is completed, the event script is loaded into memory and ready for automatic execution in response to system log events. For more information, see Executing Event Scripts in an Event Policy.

Replacing an Event Script

You can update or replace an existing event script without changing the device’s configuration or disrupting operations. Follow these steps:

  1. Edit or write the new event script.

    For information about writing event scripts, see Writing Event Scripts.

  2. Copy the script to the /var/db/scripts/event directory on the hard drive or the /config/scripts/event directory on the flash drive; for information about setting the storage location for scripts, see Storing Event Scripts in Flash Memory. Only users who belong to the Junos super-user login class can alter files in these directories.

    Note: If the device has dual Routing Engines, remember to copy the script to the /var/db/scripts/event or /config/scripts/event directory on both Routing Engines. The commit synchronize command does not automatically copy scripts between Routing Engines.

  3. Issue the request system scripts event-scripts reload operational mode command.

    user@host> request system scripts event-scripts reload

All event scripts are reloaded into the eventd process’ memory.