[plug] clear the screen when using the watch utility

W.Kenworthy billk at iinet.net.au
Sat Oct 29 17:09:45 WST 2005


Thanks Cameron.  This has solved the problem nicely.

BillK

On Sat, 2005-10-29 at 11:16 +0800, Cameron Patrick wrote:
> W.Kenworthy wrote:
> 
> > I use watch to run "ntp -p" and some other monitor commands.  The
> > problem is when I change networks and therefore ntp servers, the number
> > of servers changes, so ntp writes to a different place on the screen
> > without clearing the previous.  Another problem is when the network is
> > unreachable, the data is unreadable.  Run 'watch ntp -p' and stop the
> > ntp daemon, wait a few seconds and restart ntp and you will see what I
> > mean.
> 
> This is because when the server is down, ntpq writes error messages to
> stderr rather than useful information to stdout.  Watch doesn't
> capture stderr and so the information overwrites watch's display.
> Then the display library that watch uses (ncurses) gets confused about
> what is currently on the screen and doesn't update correctly.  Try this:
> 
>     $ watch ntpq -p '2>&1'
> 
> Cameron.
> 
> _______________________________________________
> PLUG discussion list: plug at plug.org.au
> http://www.plug.org.au/mailman/listinfo/plug
> Committee e-mail: committee at plug.linux.org.au



More information about the plug mailing list