how to start growl via the command line
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 wo开发者_JAVA百科uld I start Growl via the command line?
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
pgrep growlnotify || growlnotify <options> &
精彩评论