source: etc/cron.hourly/qtp-clean-trash @ 113

Revision 113, 1.3 KB checked in by eric, 5 years ago (diff)
  • 09/11/09 shubes - changed -ctime to -mtime, refactored to simplify
  • Property svn:executable set to *
Line 
1#!/bin/bash
2
3# 09/11/09 - Eric <ejs@shubes.net>
4# changed -ctime to -mtime
5# refactored to simplify a bit
6#
7# 07/06/07 - Jake <jake@v2gnu.com>
8# This is a modified version of Erik Espinoza's <espinoza@forcenetworks.com>
9# qtp-prune.sh script. It has been modified to be used with the QmailToaster-Plus
10# package.  It will delete files in the Trash folders that are older than 5
11# days, and can be modified by adjusting the DELTIME variable.
12#
13# 23/10/2007 - Davide <buzzz@synhack.it>
14# Added the possibility to use an external file to configure the deltrash value
15# just put in DELTIME_FILE the path of the file which contain the value
16
17# default DELTIME value
18DELTIME=5
19
20# config file for deltrash
21DELTIME_FILE="/var/qmail/control/deltrash"
22
23# see if there is a configuration file for DELTIME
24if [ -e "$DELTIME_FILE" ] ; then
25  DELTIME_TMP=`cat $DELTIME_FILE`
26  if [ "$(echo $DELTIME_TMP | grep "^[[:digit:]]*$")" ] ; then
27    DELTIME=$DELTIME_TMP
28  fi
29fi
30
31# find and process each .Spam directory
32# then find and process each file in the .Spam directory
33# (this could probably all be done in a single find command)
34
35for directory in $(find /home/vpopmail/domains -type d -name .Trash); do
36  for file in $(find $directory -type f -mtime +$DELTIME); do
37    rm -f ${file}  >/dev/null 2>&1
38  done
39done
Note: See TracBrowser for help on using the repository browser.