diff --git a/src/Makefile b/src/Makefile index bf19a35f..95e57ce9 100644 --- a/src/Makefile +++ b/src/Makefile @@ -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/ diff --git a/src/mail_deletion.sh b/src/mail_deletion.sh index cd0297b2..b50b836e 100755 --- a/src/mail_deletion.sh +++ b/src/mail_deletion.sh @@ -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