Tag Archives: scripting

scripting commands in junos

One of the things that I need during troubleshooting sessions is to run a specific command at regular intervals. Instead of doing this manually you can create a tiny script to run your command every second for you. Here is how you can do it;

My operational command that I want to monitor is “show route receive-protocol bgp” as I am interested in the change in the number of routes advertised from BGP speaker

Create this file under the operating system shell by vi editor and save it into a file e.g route_monitor.sh then run it like;

You will see that script will sleep 1 sec and then run the operational command for you. The operational show command is just a silly example. You can replace it with anything you like e.g neighbor monitoring etc.