[IMP]Backups crons fixes and improving by addings proper logs

This commit is contained in:
Fabien Bourgeois 2016-10-08 07:31:14 +02:00
parent 9f05ffff85
commit b0e931ca0f
6 changed files with 18 additions and 6 deletions

View File

@ -9,6 +9,7 @@ RUN apt-get update && apt-get install --no-install-recommends -y \
COPY crontab /etc/crontab
RUN chmod 644 /etc/crontab
RUN touch /var/log/cron.log
WORKDIR /opt/backup
COPY rsync.template .

View File

@ -1,4 +1,6 @@
# hourly backup
# m h dom mon dow user command
0 * * * * root /bin/bash /opt/backup/rsync.sh
0 1 * * * root /bin/python /opt/backup/plan.py
15 * * * * root /bin/bash /opt/backup/rsync.sh >> /var/log/cron.log 2>&1
* 3 * * * root /usr/bin/python /opt/backup/plan.py >> /var/log/cron.log 2>&1
# empty line needed

View File

@ -2,4 +2,4 @@
envsubst < /opt/backup/rsync.template > /opt/backup/rsync.sh
envsubst < /opt/backup/plan.tpl.py > /opt/backup/plan.py
cron -f
cron && tail -f /var/log/cron.log

View File

@ -3,14 +3,21 @@ MAINTAINER Yaltik - Fabien Bourgeois <fabien@yaltik.com>
ENV ODOO_ADMIN_PASSWORD admin
ENV ODOO_DATABASES demo
WORKDIR /home/odoo
USER root
RUN mkdir backups
RUN apt-get install -y --no-install-recommends cron gettext-base
COPY crontab /etc/crontab
RUN chmod 644 /etc/crontab
RUN touch /var/log/cron.log
COPY backup.template .
COPY launch.sh .
RUN chown -R odoo:odoo .
RUN chown -R odoo:odoo . && chown odoo:odoo /var/log/cron.log
VOLUME /home/odoo/backups
CMD bash launch.sh

View File

@ -1,3 +1,5 @@
# daily odoo backup
# m h dom mon dow user command
0 0 * * * odoo /bin/bash /opt/odoo/backup.sh
* 2 * * * odoo /bin/bash /home/odoo/backup.sh >> /var/log/cron.log 2>&1
# empty line required at the end of this file for a valid cron file.

View File

@ -2,4 +2,4 @@
envsubst < /home/odoo/backup.template > /home/odoo/backup.sh
chown odoo:odoo /home/odoo/backup.sh
cron -f
cron && tail -f /var/log/cron.log