summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xlocalrmstaleaccounts10
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