diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..996c924 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +ko_fi: DumpName diff --git a/Dockerfile b/Dockerfile index d45a7a8..682762d 100755 --- a/Dockerfile +++ b/Dockerfile @@ -18,7 +18,8 @@ ENV DEBIAN_FRONTEND=noninteractive \ EXTRA_OPTIONS=--nouser-config \ PYZOR_SITE=public.pyzor.org:24441 \ DETAILED_LOGGING="false" \ - LIST_FOLDERS="false" + LIST_FOLDERS="false" \ + INTERVAL_MINUTES=1 #Set Versions of used Software ARG SPAMC_VERSION=4.0.0-6 diff --git a/README.md b/README.md index bb9be4b..c3b1a93 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Configuration: There are 2 volumes, their content is initialized during containe To configure your IMAP accounts, create a new .conf file in the `/var/lib/mailaccounts` volume for each IMAP account that you want to be filtered. The files are JSON files, see the example below to learn about mandatory and optional parameters. -The container runs a learning process on startup, so do not leave a configuration with a huge email directory active if you want the container to start in a reasonnable time. +The container runs a learning process on startup, so do not leave a configuration with a huge email directory active if you want the container to start in a reasonable time. **Note: As this image needs to store your _password in cleartext_ you should only use it in an environment that you fully trust!** Be aware of the risk that this involves! @@ -62,7 +62,7 @@ The following Docker Environment Variables can be set: | CRON_HOUR | 1 | hour for daily spam learning | | CRON_MINUTE | 30 | minute for daily spam learning | | TZ | UTC | time zone | -| USERNAME | debian-spamd | username to run spammassin-deamon | +| USERNAME | debian-spamd | username to run spammassin-daemon | | HAM_BATCH_SIZE | 50 | max amount of ham messages to learn per learning run | | SPAM_BATCH_SIZE | 50 | max amount of spam messages to learn per learning run | | FILTER_BATCH_SIZE | 50 | max amount of messages to filter per run | @@ -71,5 +71,15 @@ The following Docker Environment Variables can be set: | PYZOR_SITE | public.pyzor.org:24441 | pyzor URI | | DETAILED_LOGGING | false | enables verbose logging of isbg/SA | | LIST_FOLDERS | false | Print list of mailboxes and folders on startup. Settings this to "only" will terminate the container after listing. | +| INTERVAL_MINUTES | 1 | Interval in minutes in which the spam search should be run | + +## Support + +Docker-ISBG is a free docker image powered by other open source. I am not able to provide full support, however if you find any bugs or if you need a new feature you can create an issue. +If you want to support my work you can do this through my ko-fi page: + +https://ko-fi.com/dumpname + +## License [![GPLv3 license](https://img.shields.io/badge/License-GPLv3-blue.svg?style=for-the-badge)](http://perso.crans.org/besson/LICENSE.html) diff --git a/scripts/startup.sh b/scripts/startup.sh index abcdb45..43a636c 100755 --- a/scripts/startup.sh +++ b/scripts/startup.sh @@ -1,5 +1,7 @@ #!/bin/bash +intervalSeconds=$(( INTERVAL_MINUTES * 60 )) + mkdir /root/currentState source /usr/local/pythonVenv/bin/activate if [ ! -f /root/currentState/startupDone ]; then @@ -69,7 +71,7 @@ function main { learnSpam fi findSpam - sleep $(( 60 - 10#$(date +%S) )) + sleep $(( intervalSeconds - 10#$(date +%S) )) done } diff --git a/scripts/status.sh b/scripts/status.sh index 59842d1..fc5632b 100644 --- a/scripts/status.sh +++ b/scripts/status.sh @@ -35,10 +35,10 @@ if [[ $(date +%s) -gt $nextScheduledLearn ]]; then exit 1 fi -nextScheduledSearch=$(($(date -r /root/currentState/spamSearched +%s) + 60*3 )) +nextScheduledSearch=$(($(date -r /root/currentState/spamSearched +%s) + 60*3*INTERVAL_MINUTES )) if [[ $(date +%s) -gt nextScheduledSearch ]]; then if [[ $DETAILED_LOGGING == "true" ]]; then - >&2 echo "HELTHCHECK: No spam search in last 3 minutes" + >&2 echo "HELTHCHECK: No spam search in last $(( 3 * INTERVAL_MINUTES )) minutes" fi exit 1 fi