Skip to content

Instantly share code, notes, and snippets.

View adrien-mogenet's full-sized avatar

Adrien Mogenet adrien-mogenet

View GitHub Profile
# 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