1

创建这样的脚本是否有意义,或者假脱机文件可能会损坏?

我希望能够将最大邮件假脱机文件大小控制为 500MB 或保留一个月,将其余部分存档,以先到者为准:

/var/spool/mail/* {
monthly
size 500M
missingok
rotate 24
notifempty
sharedscripts
}
4

1 回答 1

0

我没有为此使用 logrotate。我所做的是将假脱机文件重定向到 /dev/null 以清除它们。我之前也停止了我的电子邮件服务,并在清理后启动了它。你可以根据需要定制这个

echo "emailclean.sh starting on $(date)"
echo "Stopping fetchmail service"
#/sbin/initctl stop <service>
pkill fetchmail
sleep 10
echo "Cleaning up old mail"
cat /dev/null > /var/spool/mail/root
cat /dev/null > /var/spool/mail/webalert
sleep 10
echo "Starting fetchmail Service as user webalert"
sudo -u webalert /usr/bin/fetchmail
#/sbin/initctl start <service>
echo "Cleanup Complete! /var/spool/mail/root and webalert files sent to dev0"
echo "emailclean.sh finished cleanup on $(date)"
于 2013-11-16T03:21:46.150 回答