Remote tail with GeekTool

Today I discovered a wonderful OSX control panel called GeekTool, which lets you put all kinds of stuff on your desktop. I wish I had known about this long ago, but better late than never =)

My goal was to tail a logfile on a remote server and display it on my desktop. GeekTool supports three types of “Geeklet”: File, Image, and Shell. File displays the content of a file, Image displays an image, and Shell displays the output of a shell command (good thing I’m here to clarify!) Each of them has various options, which the GeekTool website documents in further detail.

The shell geeklet is implemented as a (probably recurring) shell command that gets run, with the output being shown on completion. Unfortunately, this rules out the simple approach of `ssh user@server “tail -f /var/log/yourlog”`. By running an ssh process to tail the log and piping the output into a local file, we can happily have our “log tail” without continuous ssh connects and disconnects: `ssh -f user@server “tail -f /var/log/yourlog” > /tmp/server_log_yourlog`.

Throw in a file geeklet, and you’re done. I happened to want the newest text on top, so I used a shell geeklet of `tail -r -100 /tmp/server_log_yourlog`. Enjoy your upside-down live server logs on your desktop!