exit 1
fi
-DIR="$HOME/.bsmtp"
+DIR="$HOME/tmp/.bsmtp"
mkdir -p "$DIR"
cd "$DIR"
# By default, lockfile-create gives up after three minutes, so don't cron
# this any more frequently than that without supplying a --retry argument.
lockfile-create "$HOST"
+# Race condition pointed out by pjb: this doesn't guarantee that the lock is
+# held before the critical section starts.
lockfile-touch "$HOST" &
TOUCH="$!"
trap 'kill "$TOUCH"; lockfile-remove "$HOST"' EXIT ERR HUP INT QUIT TERM