I stumbled onto this group while trying to find a solution to HG
crashing in Lion... I also noticed that it usually happens when the
system wakes from sleep (e.g., when I open the lid). As a temporary
workaround, I threw together a small quick script that checks to see
if HG is running and tries to restart it if it's not. I invoke this
every 5 minutes with cron. This minimizes my frustrations for the time
being... Sharing below in hopes that it helps someone else until a
permanent fix is provided

(I have also had issues with GrowlTunes crashing, so the script also
checks that--you could easily remove the GT section if not needed.)

To use, copy the script below to a text file, save it to something
like ghwatchdog.sh in your home directory. Then, add a crontab entry
like:

*/5     *       *       *       *       /path/to/ghwatchdog.sh

...Of course, if you don't know how to create/edit crontab entries,
you probably shouldn't use my workaround. But I digress.

-Justin


********** BEGIN ghwatchdog.sh SCRIPT **********

#!/bin/bash

# Watchdog script to run from cron to ensure that
# HardwareGrowler and GrowlTunes helpers are running.

NOTIFY='/usr/local/bin/growlnotify'
HG='/Applications/HardwareGrowler.app/Contents/MacOS/HardwareGrowler'
GT='/Applications/GrowlTunes.app/Contents/MacOS/GrowlTunes'


if (ps -ax | grep $HG | grep -v grep > /dev/null 2>&1 ) ; then
# Simply, if there's a process, then HardwareGrowler appears to be
running--do nothing.
                # $NOTIFY -m 'ghwatchdog verified that HardwareGrowler is 
running.'
ghwatchdog.sh
                :
else
# If there's NO process, HardwareGrowler ain't running--start it.
                $NOTIFY -m 'ghwatchdog ran and determined that HardwareGrowler
appears to be DOWN; attempting to restart.' ghwatchdog.sh
                $HG &
                if (ps -ax | grep $HG | grep -v grep > /dev/null 2>&1 ) ; then
                # Check again to see if HardwareGrowler is running.
                                $NOTIFY -s -m 'ghwatchdog successfully started 
HardwareGrowler.'
ghwatchdog.sh
                else
                                $NOTIFY -s -m 'ghwatchdog could not start 
HardwareGrowler; manual
intervention may be required.' ghwatchdog.sh
                fi
fi

if (ps -ax | grep $GT | grep -v grep > /dev/null 2>&1 ) ; then
# Simply, if there's a process, then GrowlTunes appears to be running--
do nothing.
                # $NOTIFY -m 'ghwatchdog verified that GrowlTunes is running.'
ghwatchdog.sh
                :
else
# If there's NO process, GrowlTunes ain't running--start it.
                $NOTIFY -m 'ghwatchdog ran and determined that GrowlTunes 
appears to
be DOWN; attempting to restart.' ghwatchdog.sh
                $GT &
                if (ps -ax | grep $GT | grep -v grep > /dev/null 2>&1 ) ; then
                # Check again to see if GrowlTunes is running.
                                $NOTIFY -s -m 'ghwatchdog successfully started 
GrowlTunes.'
ghwatchdog.sh
                else
                                $NOTIFY -s -m 'ghwatchdog could not start 
GrowlTunes; manual
intervention may be required.' ghwatchdog.sh
                fi
fi

********** END ghwatchdog.sh SCRIPT **********

-- 
You received this message because you are subscribed to the Google Groups 
"Growl Discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/growldiscuss?hl=en.

Reply via email to