Created
January 28, 2016 09:01
-
-
Save adrien-mogenet/c4009b9372f67aa2a39e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Handle passphrase for ssh, to avoid typing it everytime. | |
# Note that we don't use -delete as this won't work properly on | |
# FreeBSD and MacOSX, and we need to redirect stderr to avoid | |
# the 'No such file...' error message. | |
SSH_WITNESS_FILE="/tmp/is_ssh_passphrase_ok" | |
SSH_TTL=86400 | |
SSH_TTL_MINUTES=$((SSH_TTL / 60)) | |
find "$SSH_WITNESS_FILE" -cmin "+${SSH_TTL_MINUTES}" -type f \ | |
-exec rm -rf {} \; >/dev/null 2>/dev/null | |
if [ ! -f $SSH_WITNESS_FILE ]; then | |
ssh-add -t $SSH_TTL ~/.ssh/am-201601 | |
touch $SSH_WITNESS_FILE | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment