I wanted to get a growl bezel notification each time a user surfs into my web site. So, two shell scripts, one calling the other:
> cat live_logs.sh
#!/bin/sh
SERVER="my.server.com"
LOGFILE="/var/logs/httpd/access.log"
ssh $SERVER tail -fn1 $LOGFILE| . call_growl.sh
> cat call_growl.sh
#/bin/sh
IMAGE="path_to_fancy_image.gif"
while read visitor
do
growlnotify --image $IMAGE -m `echo $visitor|awk '$7!~/gif|jpg|js|css/ {print $1,$7}'`
done
This actually works (provided has access to server & read-rights to log file in default log format), apart from the script window outputting the growlnotify help text for each hit:
Usage: growlnotify [-hsvwc] [-i ext] [-I filepath] [--image filepath]
.
.
.
I'm no script guru, and I'm sure one of you could find an easier way of accomplishing this, perhaps in a single script. My main concern is that annoying help message. Suggestions?