summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2023-05-18 10:19:02 +0200
committerJonas Smedegaard <dr@jones.dk>2023-05-18 10:19:02 +0200
commitf85d328d477533d03148321a5b7d40cd18a06c41 (patch)
tree5b3eb62640ccf8d84d2187a0d8d89d6a0c747ec8
parenta82532e291f5f0b287b4ff78473a16eeb61a2184 (diff)
use doveadm to check for new mail untouched (file-based check is unreliable)
-rwxr-xr-xlocalrmstaleaccounts6
1 files changed, 1 insertions, 5 deletions
diff --git a/localrmstaleaccounts b/localrmstaleaccounts
index c830fb0..41cb602 100755
--- a/localrmstaleaccounts
+++ b/localrmstaleaccounts
@@ -73,11 +73,7 @@ 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 find "$home/Maildir/new" -maxdepth 0 -type d -mtime +365 | grep -q .; then
- remove_account "$user" "Removing user $user: Maildir INBOX/new untouched for a year"
- elif find "$home/Maildir/cur" -maxdepth 0 -type d -mtime +365 | grep -q .; then
- remove_account "$user" "Removing user $user: Maildir INBOX/cur untouched for a year"
- elif find "$home/Maildir/new" -type f -mtime +365 | grep -q .; then
+ 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"
else
info "Skipping user $user"