From 7266b05db721af5eb9b7d6d4c77e29c5a5917d44 Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Thu, 18 May 2023 10:58:32 +0200 Subject: tighten check for old untouched mail; shorten reason passed to localrmaccount --- localrmstaleaccounts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/localrmstaleaccounts b/localrmstaleaccounts index 4f39c25..a726c6b 100755 --- a/localrmstaleaccounts +++ b/localrmstaleaccounts @@ -55,7 +55,7 @@ info() { } remove_account() { - warn "$2" + warn "Removing user $1: $2" [ -n "$DRY_RUN" ] || localrmaccount "$1" "$2" } @@ -75,8 +75,8 @@ for user in "$@"; do warn "Skipping user $user: target in /etc/aliases" elif find -- /var/lib/radicale/collections/collection-root -maxdepth 1 -type d -name "$user" -not -empty | grep -q '^'; then warn "Skipping user $user: Uses Radicale" - elif doveadm search -u "$user" MAILBOX INBOX SAVEDBEFORE 52weeks NEW | grep -q .; then - remove_account "$user" "Removing user $user: new mail in INBOX untouched for a year" + elif doveadm search -u "$user" MAILBOX INBOX SAVEDBEFORE 52weeks NEW | grep -q . && ! doveadm search -u "$user" MAILBOX INBOX SAVEDSINCE 52weeks \( NOT NEW \); then + remove_account "$user" "new mail in INBOX untouched for a year, and none touched more recently" else info "Skipping user $user" fi -- cgit v1.2.3