Hey there,
I modified the qtprune script, trying to purge the Trash folder and making it
run every sunday, and leaving the spam aside.
After running several times, I still have the files in
/var/qmail/vpopmail/domains/xxx.com.ar/kkk/Maildir/.Trash/cur
Heres the script I use, with my remarks for posting it here.
 
Regards, Sergio
 
#!/bin/bash
 
# qtprune.sh
#
# This file can be put in /etc/cron.daily
# and will prune Trash/Spam directories
# Nov 7, 2006
#
# 3/5/2007 Added date configuration capability
#
# Erik A. Espinoza < <mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED]
#
#
#
# Number of days for Trasn
TRASH_DAYS="0" [SM] b/c I want to delete all files there.
# Number of days for Spam
SPAM_DAYS="28"
# Find Trash Dir
PATH_TRASH="`find /var/qmail/vpopmail/domains -type d -name .Trash`"
# Find Spam Dir
#PATH_SPAM="`find /home/vpopmail/domains -type d -name .Spam`"
 

# Exit if no spam or trash directories found
if [ -z "${PATH_TRASH}" ] && [ -z "${PATH_SPAM}" ]; then [SM] I also removed the
&& part but nothing
   exit 0
   fi
 
# Delete Trash older than $TRASH_DAYS days
# if Trash directories found
if [ -n "${PATH_TRASH}" ]; then
   for each in "${PATH_TRASH}" ; do
      FILES_TO_DELETE="`find ${each} -type f -ctime +${TRASH_DAYS}`"
     if [ -n "${FILES_TO_DELETE}" ]; then
   for file in ${FILES_TO_DELETE} ; do
     if [ -n ${file} ]; then
      rm -f ${file}  >/dev/null 2>&1
    fi
  done
 fi
done
fi
 
[SM] dont need this part.
# Learn and Delete Spam older than $SPAM_DAYS
# days if Spam directories found
#if [ -n "${PATH_SPAM}" ]; then
#  for each in "${PATH_SPAM}" ; do
#      FILES_TO_DELETE="`find ${each} -type f -ctime +${SPAM_DAYS}`"
#     if [ -n "${FILES_TO_DELETE}" ]; then
#   for file in ${FILES_TO_DELETE} ; do
#     if [ -n ${file} ]; then
#      sudo -u vpopmail -H sa-learn --spam ${file}  >/dev/null 2>&1
#   rm -f ${file}  >/dev/null 2>&1
#     fi
#    done
#  fi
# done
# fi
 
---
Sergio Minini
NetKey Solutions
( 4742.1101
 <http://www.netkey.com.ar/> http://www.netkey.com.ar
 <http://www.totemsoft.com.ar/> http://www.totemsoft.com.ar
 

Reply via email to