gorn.ch

Tobias Ebnöther's personal blog

tail -f to growl

What I'd like to do is to observe a file with growl (the apache error_log in my case). Getting inspired by this article I wrote a little script called tailf2growl just copy it to /usr/local/bin/tailf2growl or something:

#!/bin/sh
if [ -z "$1" ]; then
echo "Missing filename"
exit 1
fi

tail -n0 -F $1 | while read; do
echo $REPLY | growlnotify -a tailfgrowl -t $1;
done

The usage is simple as hell just do it like this:

tailf2growl /var/log/httpd/error_log 
Related Entries:
NetNewsWire Lite vs Vienna memory usage
Living with Terminal.app
Fixing the delete key in Terminal.app
Nice screenrc and common keystokes
Setting up relayhost for postfix on OSX (with ssl and authentication)
Comments (3)  Permalink

Comments

Johan @ 11.07.2007 11:30 CET
thx, just what i needed
Daniel @ 13.11.2007 20:57 CET
How i can implement this script with Grep or something, so i can show lines containing, say, only PUT messages?
ebi @ 14.11.2007 09:09 CET
Just extend the growlnotify call to something like this:

echo $REPLY | grep PUT | growlnotify -a tailfgrowl -t $1;
No new comments allowed (anymore) on this post.
Powered by Flux CMS