Skip to content

Instantly share code, notes, and snippets.

@thwarted
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thwarted/ea392da4da0aaf8f9c19 to your computer and use it in GitHub Desktop.
Save thwarted/ea392da4da0aaf8f9c19 to your computer and use it in GitHub Desktop.
notify on ssh-agent use
#!/bin/bash
countfile=/tmp/agentcount.${USER}.$( date +%Y%m%d )
c=$( cat "$countfile" 2>/dev/null )
c=$(( c + 1 ))
echo $c > "$countfile"
msg="${*/Allow use of/Using}"
msg="$( echo "${msg/\?/}" | fold -w 34 )"
exec /usr/bin/notify-send --expire-time=3000 -u normal -i /usr/share/icons/hicolor/48x48/apps/seahorse.png "ssh-agent use" "$( date +%Y-%m-%d\ %T )\n$msg"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment