I’ve been doing a lot of work with Vyatta of late, and one of the great things about having a router based on Debian is that you can combine Cisco-/Juniper-style CLI with Linux goodies. One of my favourite Linux utilities is watch, which just runs a command repeatedly and shows you its output. So to watch a mail queue empty after you’ve fixed a downstream mail server, one might run:
watch "mailq | tail"
On Vyatta, this comes in handy if one wants to watch a route table or something similar. However, by default, the CLI will not allow you to run “show” commands directly, because they’re implemented internally by vbash, the Vyatta version of the well-known Linux/Unix shell, bash. So, for example, the following will not work:
watch "show ip ospf database"
watch "vbash -c 'show ip ospf database'"
The trick is to use the -i flag to vbash, which tells it to assume that it’s an interactive shell, like so:
watch "vbash -ic 'show ip ospf database'"
I’m not sure why Vyatta felt it necessary to require this, since the only conceivable reason one would run vbash instead of bash is to get access to the Vyatta extensions, but this is an easy and painless workaround. (I’ve also documented this at the Vyatta forum thread that talks about it, since Google still points there for a number of searches – hopefully they’ll update the links soon.)
Note also the double quotes are necessary to tell watch to run send the entire command to its own internal shell. If you have lots of $ variables and the like, this will quickly turn into quote and backslash hell, so keep it simple, or put your commands in a script file.