开发者

how to start growl via the command line

开发者 https://www.devze.com 2022-12-26 00:24 出处:网络
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 t

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> &
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号