watch - execute a program periodically, showing output fullscreen

Watch

Coming from Linux, I have become used to the watch tool. The program is very simple, it lets you run a command at a given interval, and update the terminal with the output. It’s like a simple while loop that runs a command, but it uses ncurses to update the view, which makes it easy to spot differences.

Compiling it on SmartOS was straight forward, the hardest part was finding the source of watch(1). It turns out it is bundled with a handful of tools for dealing with the Linux proc filesystem. Because of this, most of the tools wont compile (or be useful) on an Illumos based operating system, so the Makefile proved to not be helpful.

To install watch(1) on SmartOS, you first have to grab the source and extract it

wget http://procps.sourceforge.net/procps-3.2.8.tar.gz
tar xf procps-3.2.8.tar.gz
cd procps-3.2.8

Then, you need make sure you have the proper dependencies

pkgin in ncurses

Finally, compile it and install it manually

gcc -I/opt/local/include/ncurses -L/opt/local/lib -lncurses -m64 watch.c -o watch
cp -f ./watch /opt/local/bin
cp -f ./watch.1 /opt/local/share/man/man1/

That will ensure the program is installed along with its manpage

dave @ [ dave-01 :: (SunOS) ] ~ $ watch --version
0.2.0