Commit 92965e64 authored by Alan Garcia's avatar Alan Garcia
Browse files

Mail deletion

parent 09e0234e
......@@ -25,8 +25,8 @@
# Purpose of file: Makefile des binaires de /usr/lib/alternc
# ----------------------------------------------------------------------
#
SETUID=mail_add mail_del quota_edit quota_get mem_add mem_del du.pl
SCRIPTS=sqlbackup.sh rawstat.daily quota_init quota_delete update_domains.sh slave_dns sendmail spoolsize.php fixperms.sh alternc-dboptimize export_account.php cron_users_doit.sh cron_users.sh compress_logs.sh delete_logs.sh quota-warning.sh
SETUID=quota_edit quota_get mem_add mem_del du.pl
SCRIPTS=sqlbackup.sh rawstat.daily quota_init quota_delete update_domains.sh slave_dns sendmail spoolsize.php fixperms.sh alternc-dboptimize export_account.php cron_users_doit.sh cron_users.sh compress_logs.sh delete_logs.sh quota-warning.sh mail_deletion.sh
LIBS=functions.sh functions_hosting.sh functions_dns.sh
BIN=$(DESTDIR)/usr/lib/alternc/
......
......@@ -31,6 +31,10 @@ elif [ -f "$LOCK_FILE" ]; then
fi
fi
# If there is ionice, add it to the command line
ionice=""
ionice > /dev/null && ionice="ionice -c 3 "
# We lock the application
echo $$ > "$LOCK_FILE"
......@@ -44,8 +48,17 @@ mysql_query "SELECT id, quote(replace(path,'!','\\!')) FROM mailbox WHERE mail_a
echo "Error : this directory will not be deleted, pattern incorrect"
continue
fi
test -d $path && nice 10 rm -rf $path
mysql_query "DELETE FROM mailbox WHERE id=$id;"
# If no dir, DELETE
# If dir and rm ok, DELETE
# Other case, do nothing
if [ -d $path ] ; then
$ionice rm -rf $path && mysql_query "DELETE FROM mailbox WHERE id=$id AND mail_action='DELETING';"
# Do the rm again in case of newly added file during delete. Should not be usefull
test -d $path && $ionice rm -rf $path
else
mysql_query "DELETE FROM mailbox WHERE id=$id AND mail_action='DELETING';"
fi
done
# List the adresses to DELETE
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment