From 67c5793ecccb05f9fad08958a121d0b7ae857b4e Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Tue, 28 Sep 2021 16:28:35 +0200 Subject: avoid removing user accounts referenced in /etc/aliases or holding Radicale content --- localrmstaleaccounts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/localrmstaleaccounts b/localrmstaleaccounts index 137dd61..f3c9b12 100755 --- a/localrmstaleaccounts +++ b/localrmstaleaccounts @@ -65,6 +65,10 @@ for user in "$@"; do warn "Skipping user $user: Email gets forwarded" elif [ ! -d "$home/Maildir" ]; then warn "Skipping user $user: Missing Maildir" + elif postalias -s /etc/aliases | grep -qP ':\s+'"$user"'$'; then + 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 -- cgit v1.2.3