diff options
author | Jonas Smedegaard <dr@jones.dk> | 2023-05-18 10:58:32 +0200 |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2023-05-18 10:58:32 +0200 |
commit | 7266b05db721af5eb9b7d6d4c77e29c5a5917d44 (patch) | |
tree | f3163cc4be07dc0d442de6271d370b4c1636d22f | |
parent | 51eb4b5f643ac1d8ee7a2ab300a792827d53a287 (diff) |
tighten check for old untouched mail; shorten reason passed to localrmaccount
-rwxr-xr-x | localrmstaleaccounts | 6 |
1 files 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 |