List
I have running scripts qtprune.sh, apparently this ok. but whenever it runs,
it does not clean any to me of the folders. Trash or. Junk
aquei I leave a copy of he himself

#!/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 <[EMAIL PROTECTED]
#
#
#
# Number of days for Trash
TRASH_DAYS="1"
# Number of days for Junk
JUNK_DAYS="1"
# Find Trash Dir
PATH_TRASH="`find /home/vpopmail/domains -type d -name .Trash`"
# Find Spam Dir
PATH_JUNK="`find /home/vpopmail/domains -type d -name .Junk`"


# Exit if no spam or trash directories found
if [ -z "${PATH_TRASH}" ] && [ -z "${PATH_JUNK}" ]; then
   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

# Delete Junk older than $JUNK_DAYS days
# if Junk directories found
if [ -n "${PATH_JUNK}" ]; then
   for each in "${PATH_JUNK}" ; do
       FILES_TO_DELETE="`find ${each} -type f -ctime +${JUNK_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


exit 0
# EOF

Reply via email to