Created
December 6, 2011 07:23
-
-
Save sotarok/1437185 to your computer and use it in GitHub Desktop.
Mac OS X で Growl が暴走したときに再起動 ref: http://qiita.com/items/1302
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
PID=$(ps ax | grep Growl.app | grep -v grep | awk '{print $1};') | |
test -z "$PID" && open -j -a Growl && echo "Growl restarted on $(date) :: pid not found ($PID)" >> /tmp/growl_restart.log && exit | |
CPU_USAGE=$(top -pid $PID -l 2 -s 5 -stats cpu | tail -n1 | cut -d"." -f1) | |
if test $CPU_USAGE -gt 80 | |
then | |
killall Growl | |
open -j -a Growl | |
echo "Growl restarted on $(date) :: pid=$PID" >> /tmp/growl_restart.log | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment