[plug] clear the screen when using the watch utility
Cameron Patrick
cameron at patrick.wattle.id.au
Sat Oct 29 11:16:13 WST 2005
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.
More information about the plug
mailing list