diff --git a/build/Dockerfile.ubuntu b/build/Dockerfile.ubuntu index 911c027..82d5b11 100644 --- a/build/Dockerfile.ubuntu +++ b/build/Dockerfile.ubuntu @@ -25,7 +25,7 @@ RUN apt remove -y nano* exim*; \ && apt dist-upgrade -y \ && bash -c "echo \"postfix postfix/main_mailer_type string 'Internet Site'\" | debconf-set-selections" \ && apt install -y \ - busybox-syslogd rsync \ + busybox busybox-syslogd rsync \ ca-certificates \ git wget bind9-host acl dbconfig-no-thanks at \ nginx \ @@ -40,10 +40,15 @@ RUN apt remove -y nano* exim*; \ && rm -r -f /var/lib/apt/lists \ # Create vmail user && adduser vmail --system --group --uid 600 --disabled-login --home /var/vmail/ --quiet \ + # Create cron folders + && mkdir -p /etc/periodic/{daily,weekly}/ /var/spool/cron/crontabs/ \ # Installer && /tmp/installer.sh \ && rm /tmp/installer.sh +# Add crontab +ADD ubuntu/cron /var/spool/cron/crontabs/root + # Expose ports EXPOSE 25 EXPOSE 80 diff --git a/build/run/docker-entrypoint/init.d/50-cron.sh b/build/run/docker-entrypoint/init.d/50-cron.sh index c7ba001..30015d4 100755 --- a/build/run/docker-entrypoint/init.d/50-cron.sh +++ b/build/run/docker-entrypoint/init.d/50-cron.sh @@ -5,43 +5,4 @@ then echo "Cron not detected, exiting..." exit 1 fi -ln -s /usr/share/webapps/roundcube/bin/cleandb.sh /etc/periodic/daily/roundcube-cleandb -ln -s /usr/local/bin/postwhite/postwhite /etc/periodic/daily/postwhite -ln -s /usr/local/bin/postwhite/scrape_yahoo /etc/periodic/weekly/postwhite_scrape_yahoo crond -b -l 0 -L /var/log/mail/cron.log - -# # Start at daemon -# atd -# -# # Roundcube cleanup (daily) -# while true -# do -# at -f /usr/share/webapps/roundcube/bin/cleandb.sh midnight -# sleep 1d -# done & -# -# # Update Postscreen Whitelists (daily) -# while true -# do -# at -f /usr/local/bin/postwhite/postwhite midnight -# sleep 1d -# done & -# -# # Update Yahoo! IPs for Postscreen Whitelists (weekly) -# while true -# do -# at -f /usr/local/bin/postwhite/scrape_yahoo midnight sunday -# sleep 7d -# done & - -# # Refresh ssl keys daily -# # https://www.golinuxcloud.com/renew-self-signed-certificate-openssl/ -# while true -# do -# sleep 1d -# openssl x509 -x509toreq -in /etc/ssl/dovecot/tls.pem -signkey /etc/ssl/dovecot/tls.key -out /tmp/new-certificate-sign-request.csr -# openssl x509 -req -days 3650 -in /tmp/new-certificate-sign-request.csr -signkey /etc/ssl/dovecot/tls.key -out /etc/ssl/dovecot/tls.pem -# rm /tmp/new-certificate-sign-request.csr -# dovecot reload -# postfix reload -# done & diff --git a/build/run/installer.sh b/build/run/installer.sh index c5b4f49..9003577 100755 --- a/build/run/installer.sh +++ b/build/run/installer.sh @@ -504,3 +504,17 @@ cat >/etc/syslog.conf <<- syslog mail.info /var/log/mail/maillog mail.* /var/log/mail/maillog.debug syslog + +############### +#// +#// Cron +#// +############### +install /dev/stdin /etc/periodic/daily/daily <<- daily +/usr/share/webapps/roundcube/bin/cleandb.sh >>/var/log/mail/cron.daily.log 2>&1 +/usr/local/bin/postwhite/postwhite >>/var/log/mail/cron.daily.log 2>&1 +daily + +install /dev/stdin /etc/periodic/weekly/weekly <<- weekly +/usr/local/bin/postwhite/scrape_yahoo >>/var/log/mail/cron.weekly.log 2>&1 +weekly diff --git a/build/ubuntu/cron b/build/ubuntu/cron new file mode 100644 index 0000000..47d78ef --- /dev/null +++ b/build/ubuntu/cron @@ -0,0 +1,7 @@ +# do daily/weekly/monthly maintenance +# min hour day month weekday command +*/15 * * * * run-parts /etc/periodic/15min +0 * * * * run-parts /etc/periodic/hourly +0 2 * * * run-parts /etc/periodic/daily +0 3 * * 6 run-parts /etc/periodic/weekly +0 5 1 * * run-parts /etc/periodic/monthly