浏览代码

Avoid duplicates

Bob Mottram 11 年前
父节点
当前提交
53f8aa5563
共有 1 个文件被更改,包括 6 次插入2 次删除
  1. 6
    2
      install-freedombone.sh

+ 6
- 2
install-freedombone.sh 查看文件

@@ -763,8 +763,12 @@ function spam_filtering {
763 763
   echo '    rm "$MAILDIR/new/$f"' >> /usr/bin/filterham
764 764
   echo 'done' >> /usr/bin/filterham
765 765
 
766
-  echo "*/3 * * * * root /usr/bin/timeout 120 /usr/bin/filterspam $MY_USERNAME" >> /etc/crontab
767
-  echo "*/3 * * * * root /usr/bin/timeout 120 /usr/bin/filterham $MY_USERNAME" >> /etc/crontab
766
+  if ! grep -q "filterspam" /etc/crontab; then
767
+    echo "*/3 * * * * root /usr/bin/timeout 120 /usr/bin/filterspam $MY_USERNAME" >> /etc/crontab
768
+  fi
769
+  if ! grep -q "filterham" /etc/crontab; then
770
+    echo "*/3 * * * * root /usr/bin/timeout 120 /usr/bin/filterham $MY_USERNAME" >> /etc/crontab
771
+  fi
768 772
   chmod 655 /usr/bin/filterspam /usr/bin/filterham
769 773
   sed -i 's/# use_bayes 1/use_bayes 1/g' /etc/mail/spamassassin/local.cf
770 774
   sed -i 's/# bayes_auto_learn 1/bayes_auto_learn 1/g' /etc/mail/spamassassin/local.cf