I had a similar itch, myself. There are a couple of enhancements and differences in my version:
<ul>
<li>mine posts a (non-sticky!) growl notification after restarting</li>
<li>mine is toggles Growl off and on rather than just restarting</li>
<li>mine kills and opens the menu item (this gives me a visual indicator of whether Growl is running; I generally don't use it as a menu)</li>
<li>mine is a shell script since it appears to run faster than an AppleScript (I use a Quicksilver "Run script" trigger for activation).</li>
</ul>
#!/bin/bash
GROWLAPP=/Library/PreferencePanes/Growl.prefPane/Contents/Resources/GrowlHelperApp.app
GROWLMENU=/Library/PreferencePanes/Growl.prefPane/Contents/Resources/GrowlMenu.app
NOTIFICATION_SCRIPT=/usr/local/bin/growlnotify
function running {
TARGET=$1
MATCH=$2
RESULT=`ps x | grep Growl | grep -v grep`
if [[ $RESULT != "" ]]
then
killall -m -HUP Growl
else
open ${GROWLAPP}
sleep 1
${NOTIFICATION_SCRIPT} 'Growl' -a'GrowlHelperApp' -m'Restarted'
open ${GROWLMENU}
fi
}
running
If you want a toggle, this is great (I just want to restart it to clear out a bunch of sticky notifications from the keyboard). If I may, I'd suggest that the killall -m could be a bit general, as it would match every process with "Growl" in the name. You might try: RESULT=ps auxwww|grep GrowlHelperApp|grep -v grep|awk '{print $2}'
and then kill $RESULT
. Works great, though!