发布脚本:定期清理垃圾邮件、垃圾箱和收件箱的过期邮件
脚本名字: cleanupmaildir.pl
运行环境:
下载附件,gunzip解压缩,然后拷贝这个文件到extman/tools/目录下,即可使用。
运行后的帮助# ./cleanupmaildir.pl
usage: ./cleanupmaildir.pl [options] ...
Options:
-d, --domain=domain.tld domain name
-e, --expiredate=180 default: 180 (days). expire date
-u, --ignoreuserlist=/path/to/userlist ignore user list
-l, --logfile=/path/to/logfile delete log to this file
-c, --check check file's path before delete it
-i, --inbox default: No Delete. Delete inbox email
-h, --help help 运行示例:
# ./cleanupmaildir.pl -d extmail.org -e 180 -u userlist.txt -l /var/log/cleanupmaildir.log
-d意思就是输入你想清理的域
-e是过期时间,默认为180天
-u是忽略用户列表,即这些用户不做清理
-l是指定日志写入的地方,如果不指定则把日志打印到标准输出
-c打印出所有用户要删除的文件路径,但是并不做删除(多谢chris建议)
-i就是指定清理收件箱,默认为不清理,这个选项请慎用
-h打印帮助
加入crontab吧,呵呵,每日清理掉“垃圾邮件”和”垃圾箱“这两个目录里的邮件,释放你的磁盘空间。
|
附件: 您所在的用户组无法下载或查看附件