diff options
author | Jonas Smedegaard <dr@jones.dk> | 2021-09-28 16:28:35 +0200 |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2021-09-28 16:28:35 +0200 |
commit | 67c5793ecccb05f9fad08958a121d0b7ae857b4e (patch) | |
tree | 4fa31af00e90174aa3e648f1687908db3c4e0686 | |
parent | 3d6dabbf2dbf0d145b101e2eb8d6fac53246caf5 (diff) |
avoid removing user accounts referenced in /etc/aliases or holding Radicale content
-rwxr-xr-x | localrmstaleaccounts | 4 |
1 files changed, 4 insertions, 0 deletions
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 |