burnett01-rsync-deployments/agent-start

13 lines
290 B
Bash

#!/bin/sh
FOLDER=${1:-default}
STORE_PATH="/tmp/ssh-agent/$FOLDER"
mkdir -p "$STORE_PATH"
# Start the SSH agent if it isn't already.
if [ -z "$SSH_AGENT_PID" ]; then
eval "$(ssh-agent)" > /dev/null
echo "$SSH_AGENT_PID" > "$STORE_PATH"/id
echo "$SSH_AUTH_SOCK" > "$STORE_PATH"/sock
fi