Add a plugin for ssh_agent
parent
ea131c879d
commit
0da8fb32b4
|
|
@ -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"
|
||||||
Loading…
Reference in New Issue