Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I have a shell script that logs messages to syslog using the 'logger' command. In my syslog.conf, I filter those messages to a specific log file. This is a portable solution that works across all unices. On OS X, I would also like to have these messages sent to growl. I have tried both of the following with no success:

*.*        |exec /usr/local/bin/growlnotify
*.*        @127.0.0.1:23052
share|improve this question
add comment

1 Answer 1

According to man syslog.conf, Mac OS X's syslog.conf can handle messages only by writing to a file, sending to a remote host's syslog, and send them to users' consoles.


Your best option is probably to send to a file, and write a daemon or a periodically running script that consumes this file and calls growlnotify with what it reads from the file, something like the following:

#!/usr/bin/env bash
while read line
do
    /usr/local/bin/growlnotify "Your App" -m "$line"
done < /path/to/file
echo -n > /path/to/file

Either keep this running all the time by wrapping in a loop, or start it every few seconds using a launchd job and the StartInterval directive. man launchd and man launchd.plist can help you here.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.