雨中的高速公路 - bluetent的个人主页

我的电脑,最近新歌,欧美音乐,酷讯,电脑技术

使用tmpwatch删除qmail过期文件

11月 8th, 2004 · No Comments

tmpwatch可删除时间为若干小时之前的旧文件,如果你对这个危险的功能不确信,可外加–test参数,能够看到除了删除文件以外的一切效果。
脚本如下(仅为抛砖引玉):

#!/bin/sh

#白名单:whitelist

HOMEDIR=”/home”
MAILDIR=”Maildir”
WHITELIST=”whitelist”
TMPWATCH=”/usr/sbin/tmpwatch”
HOURS=$1

#砍信操作
dojunk()
{
$TMPWATCH -adv –test $HOURS $1
}

if [ $# -lt 1 ]
then
echo “Usage: $0 HOURS”; exit
fi
for i in `cat /etc/passwd | awk ‘BEGIN {FS=”:”}; {print $1}’`
do
if grep $i $WHITELIST &> /dev/null
then
echo “$i is in whitelist, ignore…”
elif [ -d “$HOMEDIR/$i/$MAILDIR” ]
then
dojunk $HOMEDIR/$i/$MAILDIR
fi
done

关键字:qmail 删除邮件 tmpwatch

历史上的今天

Tags: 原创文档

0 responses so far ↓

  • There are no comments yet...Kick things off by filling out the form below.

Leave a Comment