how to start growl via the command line

7.1k views Asked by At

I have a bash script that uses growlnotify to send notifications. However, growlnotify doesn't work if Growl isn't already running, and it won't auto start Growl if it needs it, either. So I want to be able to check if Growl is running, and then start it if it isn't.
I'm thinking of doing something like:

g=$(ps -e | grep Growl | grep -v grep)
if [ -z "$g" ]  # Growl isn't running
then
# (start Growl)
fi

How would I start Growl via the command line?

2

There are 2 answers

6
Ned Deily On BEST ANSWER

Normally the Growl installer will ensure that the user doing the installing gets a login Startup item that launches GrowlHelperApp.app, the notification daemon for Growl. The app is built into the Growl PreferencePane, so you can't guarantee where it will be located; it may be in /Library/PreferencePanes or ~/Library/PreferencePanes, depending on how Growl was installed. If you feel you can't trust the user to do the right thing, you can manually launch the helper app from the command line in a location-independent manner by using its bundle identifier:

open -b com.Growl.GrowlHelperApp
3
ghostdog74 On
pgrep growlnotify || growlnotify <options> &