Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Mac OS X > piping into growlnotify

piping into growlnotify
Thread Tools
cla
Mac Enthusiast
Join Date: Mar 2000
Status: Offline
Reply With Quote
Jun 4, 2005, 06:27 AM
 
I'm trying to pipe "tail -f" into a terminal application called growlnotify (used to display messages in nice bezels on the screen). Problem is, growlnotify expects some kind of "end of stream" in the piped-in message, otherwise it won't fire off the message.

Surely there must be some way of going around this, like using sed to add an end-marker, or piping "tail -f" into a shell script that calls growlnotify explicitly as soon as something happens in the file I'm tailing.

What should I do? Any suggestions?


P.S I've searched the growl.info forums. Others have asked the same question - seems nobody has the solution though, so I though I'd try my luck here at macnn...
     
Mac Elite
Join Date: Sep 2001
Location: Chico, CA and Carlsbad, CA.
Status: Offline
Reply With Quote
Jun 4, 2005, 09:51 PM
 
Originally Posted by cla
P.S I've searched the growl.info forums. Others have asked the same question - seems nobody has the solution though, so I though I'd try my luck here at macnn...
Sounds cool, I haven't done much with growlnotify. I don't know how active the growl forums are, but I have hung out with the developers on IRC. Even if the devs aren't around, there are bunches of people in the channel that would ptobably be able to point you in the right direction. You can find them at:

irc.freenode.net #growl
"In Nomine Patris, Et Fili, Et Spiritus Sancti"

     
Dedicated MacNNer
Join Date: Aug 2002
Status: Offline
Reply With Quote
Jun 4, 2005, 09:59 PM
 
growlnotify has a commandline option you can use instead,
Code:
growlnotify title -m "message"
you're going to need more than just tail -f to get the data to growlnotify

the two simple choices are a cron job and an applescript / shell script you keep running in the background and polling the file.

--Will
     
cla
Mac Enthusiast
Join Date: Mar 2000
Status: Offline
Reply With Quote
Jun 5, 2005, 08:48 AM
 
[quote=clam2000]
Code:
growlnotify title -m "message"
"growlnotify" actually is the command line option. The whole app is simply named "growl".

What I'm doing is a

tail -f /var/log/apache/access.log | growlnotify -t "New hit!"

The above line works fine if I use cat instead of tail -f...
     
cla
Mac Enthusiast
Join Date: Mar 2000
Status: Offline
Reply With Quote
Jun 18, 2005, 06:25 PM
 
Got it:

tail -fn1 apache.log|. call_growl.sh

The pipe above could first be nicely filtered and arranged using for instance awk.
call_growl.sh look like:

#/bin/sh
while read visitor
do
growlnotify -t "web hit" -m $visitor
done



A very supervising feeling indeed...
     
Professional Poster
Join Date: Oct 1999
Location: :ИOITAↃO⅃
Status: Offline
Reply With Quote
Jun 18, 2005, 06:51 PM
 
You'll regret that the day you post your server's address to Slashdot
     
cla
Mac Enthusiast
Join Date: Mar 2000
Status: Offline
Reply With Quote
Jun 19, 2005, 06:42 AM
 
That would constitute an example of what I usually refer to as a »pleasant« problem...

:>
     
   
Thread Tools
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 06:20 PM.
All contents of these forums © 1995-2008 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.7.2 © 2000-2008, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.2.0 RC8