主题: logwatch 執行兩次:/var/spool/amavisd/quarantine/ -mtime +15

1).
logwatch:
       touch /var/spool/amavisd/quarantine; find /var/spool/amavisd/quarantine/ -mtime +15 | xargs rm -rf {}: 1 Time(s)
       touch /var/spool/amavisd/quarantine; find /var/spool/amavisd/quarantine/ -mtime +45 | xargs rm -rf {}: 1 Time(s)

2).
crontab -e -u amavis
#
# File generated by iRedMail (2017.03.28.18.08.17):
#
# Version:  0.9.6
# Project:  http://www.iredmail.org/
#
# Community: http://www.iredmail.org/forum/
#

# Delete virus mails which created 15 days ago.
## Delete virus mails which created 45 days ago.
1   5   *   *   *   touch /var/spool/amavisd/quarantine; find /var/spool/amavisd/quarantine/ -mtime +45 | xargs rm -rf {}


如何只執行一次 ?

Thanks.

回复: logwatch 執行兩次:/var/spool/amavisd/quarantine/ -mtime +15

是不是 /etc/cron.* 里还有一个 task?

3 最后由 rain6966 (2018-05-03 11:36:11) 编辑

回复: logwatch 執行兩次:/var/spool/amavisd/quarantine/ -mtime +15

find  /etc/cron.* |xargs grep '/var/spool/amavisd/quarantine'
grep: /etc/cron.d: 是個目錄
grep: /etc/cron.daily: 是個目錄
grep: /etc/cron.hourly: 是個目錄
grep: /etc/cron.monthly: 是個目錄
grep: /etc/cron.weekly: 是個目錄

# tree /etc/cron.*
/etc/cron.d
├── 0hourly
├── clamav-update
├── raid-check
└── sa-update
/etc/cron.daily
├── 0logwatch
├── logrotate
└── man-db.cron
/etc/cron.deny [error opening dir]
/etc/cron.hourly
├── 0anacron
└── awstats
/etc/cron.monthly
/etc/cron.weekly

0 directories, 9 files

沒有發現.

Thanks

回复: logwatch 執行兩次:/var/spool/amavisd/quarantine/ -mtime +15

# logwatch --service cron --range 20180509

     User amavis:
       personal crontab edited: 1 Time(s)
       touch /var/spool/amavisd/quarantine; find /var/spool/amavisd/quarantine/ -mtime +15 | xargs rm -rf {}: 1 Time(s)
       touch /var/spool/amavisd/quarantine; find /var/spool/amavisd/quarantine/ -mtime +25 | xargs rm -rf {}: 1 Time(s)

改為 -mtime +66
# logwatch --service cron --range 20180511

       touch /var/spool/amavisd/quarantine; find /var/spool/amavisd/quarantine/ -mtime +15 | xargs rm -rf {}: 1 Time(s)
       touch /var/spool/amavisd/quarantine; find /var/spool/amavisd/quarantine/ -mtime +66 | xargs rm -rf {}: 1 Time(s)

查看:
/var/log/cron
這兩天的紀錄,是沒有
touch /var/spool/amavisd/quarantine; find /var/spool/amavisd/quarantine/ -mtime +15 | xargs rm -rf {}: 1 Time(s)

-mtime +25 及 +66 是有紀錄;
這實在說不過去 , logwatch 會抓以前的log 資料.