From c1cb6c9e074f4ca61cf0def98d618d110b94fd2f Mon Sep 17 00:00:00 2001 From: Tobias Strobel Date: Sun, 8 Apr 2018 14:33:14 +0200 Subject: [PATCH 1/2] Fix cronjob errors of Dovecot expunge Recently, I discovered that the cronjob on my mailcow-dockerized host isn't working. If the script is called via crontab, the docker-compose command doesn't know where the config file is located. So I added the "cd" to change the directory to the working directory of the mailcow-dockerized instance. When executing the docker-compose exec command via cronjob, it fails with error message "the input device is not a TTY". By adding the parameter "-T" it works. --- docs/u_e-dovecot-expunge.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/u_e-dovecot-expunge.md b/docs/u_e-dovecot-expunge.md index 52d0062cd..257874710 100644 --- a/docs/u_e-dovecot-expunge.md +++ b/docs/u_e-dovecot-expunge.md @@ -31,8 +31,9 @@ If you want to automate such a task you can create a cron job on your host that ``` #!/bin/bash -/usr/local/bin/docker-compose exec dovecot-mailcow doveadm expunge -A mailbox 'Junk' savedbefore 2w -/usr/local/bin/docker-compose exec dovecot-mailcow doveadm expunge -A mailbox 'Junk' SEEN not SINCE 12h +cd /opt/mailcow-dockerized +/usr/local/bin/docker-compose exec -T dovecot-mailcow doveadm expunge -A mailbox 'Junk' savedbefore 2w +/usr/local/bin/docker-compose exec -T dovecot-mailcow doveadm expunge -A mailbox 'Junk' SEEN not SINCE 12h [...] ``` From 5a9f7efb34a3c385c04c3e8e83da4404e7a4f997 Mon Sep 17 00:00:00 2001 From: Tobias Strobel Date: Sun, 8 Apr 2018 17:31:13 +0200 Subject: [PATCH 2/2] Add note for path --- docs/u_e-dovecot-expunge.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/u_e-dovecot-expunge.md b/docs/u_e-dovecot-expunge.md index 257874710..a3ab62f7e 100644 --- a/docs/u_e-dovecot-expunge.md +++ b/docs/u_e-dovecot-expunge.md @@ -31,7 +31,9 @@ If you want to automate such a task you can create a cron job on your host that ``` #!/bin/bash -cd /opt/mailcow-dockerized +# Path to mailcow-dockerized, e.g. /opt/mailcow-dockerized +cd /path/to/your/mailcow-dockerized + /usr/local/bin/docker-compose exec -T dovecot-mailcow doveadm expunge -A mailbox 'Junk' savedbefore 2w /usr/local/bin/docker-compose exec -T dovecot-mailcow doveadm expunge -A mailbox 'Junk' SEEN not SINCE 12h [...]