aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--parcimini.bash12
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 |