SSHKeychain misbehaving
I use SSHKeychain (as a Universal Binary) to manage my SSH keys on my Mac; I never need to enter my passphrases.I sometimes notice my battery draining, and my lap burning, though, and pop open a Terminal to find that SSHKeychain is grinding away at 99% processor usage. This is not good; it's not even reproducible (it tends to happen soon after changing networks, but not always).
Here's a little script I wrote that keeps an eye on the process, killing and restarting it automatically. You can put this in a +x file in ~/bin and launch it when you log in, if you like; that way you won't forget to start it by hand! Take out all of the echos if it's too noisy for you.
Watch out for the linebreak in the important line.
LAST=0
while true
do
echo "Watching SSHKeychain..."
LINE=$(ps wwaux | fgrep SSHKeychain | fgrep -v fgrep)
USAGE=`echo "$LINE" | awk '{ print $3 }'`
USAGE=${USAGE%%.*}
PID=`echo "$LINE" | awk '{ print $2 }'`
echo "Usage is $USAGE, PID is $PID."
[ $USAGE -gt 60 ] && [ $LAST -gt 60 ] && \
kill -9 $PID && open -a SSHKeychain
LAST=$USAGE
sleep 30
done
Posted at 2007-07-06 21:02:42 by Richard • Link to SSHKeychain misbeh…
Comments, trackbacks.
