Thursday, July 8, 2004


GeekTool screenshotI just have started using a very cool, but probably not all of that necessary, tool. It is called GeekTool. It will create windows that will either always be on the desktop, or floating above other windows that will display three types of information.
  1. Contents of local text files (using tail)
  2. Local or remote graphic
  3. Output of shell command

I have included screen shot of how I am using it.
  1. In the upper right corner, there is an icon that shows the system load
  2. The lower right corner shows the active network interfaces
  3. In the lower left corner, the current calendar
  4. Right above that is the current TiVo stock graph
I run the following script once a second to get the current load


$UPTIME = `uptime`;
$UPTIME =~ s/.*averages: (S+),?.*/$1/g;
print $UPTIME;

exit 1;
exit 0;

When the script returns a non 0 result code, it displays a red icon, other wise it displays a green one.

Here is a sample of the script that I run to display the icons for the network interface. This script gets run every 10 seconds.

ifconfig en0 |grep " active"

When the script returns a 0 result code, it displays the icon for the network interface

Here is the script that I use for the calendar. I have this script run once an hour to update it correctly


echo `date "+%d %B %Y"` | awk
'{ print substr(" ",1,(21-length($0))/2) $0; }';
cal | awk -v cday=`date "+%d"` '{ fill=(int(cday)>9?"":" ");
a=$0; sub(" "fill int(cday)" ","*"fill int(cday)"*",a); print a }'

To get the graph for the TiVo stock, I entered this url, and then I have it updated every 5 minutes

I would love to use this to run a shell script to put up a couple of window so I can monitor a couple of servers that I maintain. What I would like to do is to write a script that ssh's into a server, does a sudo su -, and then tails some log files. The problem with doing this is that it will only show the output of a shell script when the shell command has finished. So I don't think that it will be possible to have it contstantly monitor a tail process on another machine.