diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2020-04-27 00:52:36 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2020-04-27 00:52:55 +1200 |
commit | 545cdfce3ea66aeceded3d4dfd12410ad5d2395c (patch) | |
tree | 0f3e389ce9129046155d68a14dc727a51c027e98 | |
parent | Send GnuPG diagnostics to stdout for logging (diff) | |
download | parcimini-545cdfce3ea66aeceded3d4dfd12410ad5d2395c.tar.gz parcimini-545cdfce3ea66aeceded3d4dfd12410ad5d2395c.zip |
Emit log message on exit
-rw-r--r-- | parcimini.bash | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/parcimini.bash b/parcimini.bash index a38d01a..8047a79 100644 --- a/parcimini.bash +++ b/parcimini.bash @@ -13,10 +13,6 @@ interval=${1:-120} hash gpg || exit hash shuf || exit -# Make a temporary file for the key listings, delete on exit -trap 'rm -f "$list"' EXIT -list=$(mktemp) || exit - # Define logging function logf() { format=$1 @@ -25,6 +21,14 @@ logf() { "$(date +'%FT%T')" "$self" "$@" } +# Make a temporary file for the key listings, delete on exit +cleanup() { + logf 'Stopped\n' + rm -f -- "$list" +} +trap cleanup EXIT +list=$(mktemp) || exit + # Define a function to retrieve all keychain fingerprints key_ids() { gpg --batch --no-tty --list-keys --with-colons | |