burnett01-rsync-deployments/agent-stop

16 lines
313 B
Plaintext
Raw Normal View History

2020-01-02 23:57:06 +08:00
#!/bin/sh
if [ ! -z "$SSH_AGENT_PID" ]; then
2020-01-03 05:38:03 +08:00
echo "Var Set"
2020-01-02 23:57:06 +08:00
ssh-agent -k
exit $?
elif [ -f "/tmp/ssh-agent-id" ]; then
2020-01-03 05:38:03 +08:00
echo "File Exists"
2020-01-03 06:08:48 +08:00
cat /tmp/ssh-agent-id
2020-01-02 23:57:06 +08:00
SSH_AGENT_PID=$(cat /tmp/ssh-agent-id)
ssh-agent -k
exit $?
else
echo "SSH_AGENT_PID not set, /tmp/ssh-agent-id doesn't exist!" 1>&2
exit 1
fi