Add a plugin for ssh_agent

pull/85/head
Changwoo Park 2011-10-13 14:34:15 +09:00
parent ea131c879d
commit 0da8fb32b4
1 changed files with 20 additions and 0 deletions

View File

@ -0,0 +1,20 @@
RUNINNG_AGENT_PID=`ps -ef | grep ssh-agent | grep -v grep | awk '{print $2}' | xargs`
if [ "$RUNINNG_AGENT_PID" = "" ] && [ -f ~/.ssh/id_rsa ]; then
MY_TIMEOUT=28800
[ "$SSH_AGENT_TIMEOUT" = "" ] || MY_TIMEOUT="$SSH_AGENT_TIMEOUT"
#28800, 8 hours. then go home
ssh-agent -t $MY_TIMEOUT | grep -v echo > ~/.ssh/ssh_agent_rc
. ~/.ssh/ssh_agent_rc
echo "ssh-agent::ssh-add:"
ssh-add
else
. ~/.ssh/ssh_agent_rc
fi;
#alias kagent="kill -9 $SSH_AGENT_PID"