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
xchat on OSX / Command as alt
Comments (3)  Permalink

Comments

Johan @ 11.07.2007 12:30 CEST
thx, just what i needed
Daniel @ 13.11.2007 21:57 CEST
How i can implement this script with Grep or something, so i can show lines containing, say, only PUT messages?
ebi @ 14.11.2007 10:09 CEST
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