diff options
author | Jonas Smedegaard <dr@jones.dk> | 2019-04-21 18:05:36 +0200 |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2019-04-21 18:05:36 +0200 |
commit | 3b4c5806e9bb057b5599e9fba0ef65e3c2adc660 (patch) | |
tree | 813a282e84139e992361c60973b287a1ad08e169 /localrmstaleaccounts | |
parent | e77dda71da5320909f8956e9f2a342c33e71ca8d (diff) |
Generalize calling localrmaccount.
Diffstat (limited to 'localrmstaleaccounts')
-rwxr-xr-x | localrmstaleaccounts | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/localrmstaleaccounts b/localrmstaleaccounts index 269bb9e..b185cfc 100755 --- a/localrmstaleaccounts +++ b/localrmstaleaccounts @@ -15,6 +15,10 @@ info() ( echo >&2 "INFO: $1" ) +remove_account() ( + localrmaccount "$1" +) + for user in $@; do home=$(getent passwd "$user" | cut -d: -f6) if [ -z "$home" ]; then @@ -25,13 +29,13 @@ for user in $@; do warn "Skipping user $user: Missing Maildir" elif find "$home/Maildir/new" -maxdepth 0 -type d -mtime +365 | grep -q .; then info "Removing user $user: Maildir INBOX/new untouched for a year" - localrmaccount "$user" + remove_account "$user" elif find "$home/Maildir/cur" -maxdepth 0 -type d -mtime +365 | grep -q .; then info "Removing user $user: Maildir INBOX/cur untouched for a year" - localrmaccount "$user" + remove_account "$user" elif find "$home/Maildir/new" -type f -mtime +365 | grep -q .; then info "Removing user $user: new mail in INBOX untouched for a year" - localrmaccount "$user" + remove_account "$user" else info "Skipping user $user" fi |