Skip to content

Fixed virus-wiper script when using the default value for VIRUSMAILS_…#540

Merged
tomav merged 1 commit intodocker-mailserver:masterfrom
danielpanteleit:master
Mar 14, 2017
Merged

Fixed virus-wiper script when using the default value for VIRUSMAILS_…#540
tomav merged 1 commit intodocker-mailserver:masterfrom
danielpanteleit:master

Conversation

@danielpanteleit
Copy link
Copy Markdown
Contributor

…DELETE_DELAY

Moved variable VIRUSMAILS_DELETE_DELAY to Dockerfile to make it visible to cron. Also removed echo in cron job to prevent sending mail for each run.

I would also suggest moving all default values to the Dockerfile so one can easily identify the used values with docker inspect.

@tomav
Copy link
Copy Markdown
Contributor

tomav commented Mar 11, 2017

Restarted build.

@danielpanteleit
Copy link
Copy Markdown
Contributor Author

OK, this did not work. Apparently the environment variable is cleared before the cron job runs. Does this actually work when setting VIRUSMAILS_DELETE_DELAY?

There are a few options left, but they all have to be done in the start script:

  1. Setting VIRUSMAILS_DELETE_DELAY in the crontab
  2. Changing virus-wiper to take a parameter and setting up the cron job in the start script with the value as a parameter.
  3. Creating virus-wiper with the actual value already in place
  4. Writing environment variables to a file and reading it in virus-wiper

I would vote for (2) as I think this is the most straight-forward solution.

@tomav
Copy link
Copy Markdown
Contributor

tomav commented Mar 13, 2017

Hmm it seems that current implementation does not work as expected, you're right (i've done that myself).
When I execute virus-wiper, manually it works.
It does not when triggered by CRON.

I think that putting the ENV in /etc/environment should do the trick if you want to try.

…DELETE_DELAY

Moved variable VIRUSMAILS_DELETE_DELAY to Dockerfile. This variable will be written to /etc/environment in the start
script to make it visible to cron. Also removed echo in cron job to prevent sending mail for each run.
@danielpanteleit
Copy link
Copy Markdown
Contributor Author

danielpanteleit commented Mar 13, 2017

The start script will now write the variable to /etc/environment. I tested it manually this time (by adding a cron job which runs every minute)

Oh, and there is a small fix by setting ONE_DIR to 0 in the Dockerfile.

@tomav
Copy link
Copy Markdown
Contributor

tomav commented Mar 14, 2017

Thanks @danielpanteleit

@tomav tomav merged commit e7efeda into docker-mailserver:master Mar 14, 2017
RichardFevrier pushed a commit to RichardFevrier/docker-mailserver that referenced this pull request Aug 26, 2019
…DELETE_DELAY (docker-mailserver#540)

Moved variable VIRUSMAILS_DELETE_DELAY to Dockerfile. This variable will be written to /etc/environment in the start
script to make it visible to cron. Also removed echo in cron job to prevent sending mail for each run.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants