tmux-clear-ssh-agent.sh 305 B

12345678910
  1. #!/usr/bin/env bash
  2. # Wipe the keys after a specified delay, unless there are still tmux clients
  3. # attached.
  4. set -e
  5. #exec > >(tee -a /tmp/tmux-timer.log) 2>&1
  6. sleep "${1-0}"
  7. if [ $(tmux list-clients | wc -l) -eq 0 ]; then
  8. export SSH_AUTH_SOCK="/run/user/$(id -u)/openssh_agent"
  9. exec ssh-add -D
  10. fi