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!

2 thoughts on “Remote tail with GeekTool

  1. I just added an alias for it to my bashrc, and noticed if the output wasn’t updating. If you wanted things to be a little more robust, you could use a crontab to check if it’s not running (and restart). There’ll be plenty of examples on google for that :)

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>