diff --git a/backups/rsyncvolumes/Dockerfile b/backups/rsyncvolumes/Dockerfile index 845c0f0..ae43248 100644 --- a/backups/rsyncvolumes/Dockerfile +++ b/backups/rsyncvolumes/Dockerfile @@ -10,8 +10,7 @@ RUN apt-get update && apt-get install --no-install-recommends -y \ # Avoid overlayfs bug with tail VOLUME /var/log -COPY crontab /etc/crontab -RUN chmod 644 /etc/crontab +COPY crontab ./crontab WORKDIR /opt/backup COPY rsync.template . diff --git a/backups/rsyncvolumes/crontab b/backups/rsyncvolumes/crontab index bd6c0bd..318a1a6 100644 --- a/backups/rsyncvolumes/crontab +++ b/backups/rsyncvolumes/crontab @@ -1,6 +1,5 @@ # hourly backup # m h dom mon dow user command -15 * * * * root /bin/bash /opt/backup/rsync.sh >> /var/log/cron.log 2>&1 -0 3 * * * root /usr/bin/python /opt/backup/plan.py >> /var/log/cron.log 2>&1 +15 * * * * /bin/bash /opt/backup/rsync.sh >> /var/log/cron.log 2>&1 +0 3 * * * /usr/bin/python /opt/backup/plan.py >> /var/log/cron.log 2>&1 # empty line needed - diff --git a/backups/rsyncvolumes/launch.sh b/backups/rsyncvolumes/launch.sh index 29ad6bc..5e19f90 100644 --- a/backups/rsyncvolumes/launch.sh +++ b/backups/rsyncvolumes/launch.sh @@ -2,4 +2,4 @@ envsubst < /opt/backup/rsync.template > /opt/backup/rsync.sh envsubst < /opt/backup/plan.tpl.py > /opt/backup/plan.py -touch /var/log/cron.log && cron && tail -f /var/log/cron.log +crontab ./crontab && touch /var/log/cron.log && cron && tail -f /var/log/cron.log diff --git a/odoo/backups/Dockerfile b/odoo/backups/Dockerfile index ab9e538..b7f2f97 100644 --- a/odoo/backups/Dockerfile +++ b/odoo/backups/Dockerfile @@ -13,8 +13,7 @@ RUN apt-get install -y --no-install-recommends cron gettext-base # Avoid overlayfs bug with tail VOLUME /var/log -COPY crontab /etc/crontab -RUN chmod 644 /etc/crontab +COPY crontab ./crontab COPY backup.template . COPY plan.py . diff --git a/odoo/backups/crontab b/odoo/backups/crontab index 7b0c140..ee5c67a 100644 --- a/odoo/backups/crontab +++ b/odoo/backups/crontab @@ -1,6 +1,5 @@ # daily odoo backup # m h dom mon dow user command -0 2 * * * odoo /bin/bash /home/odoo/backup.sh >> /var/log/cron.log 2>&1 -10 2 * * * odoo /usr/bin/python /home/odoo/plan.py >> /var/log/cron.log 2>&1 +0 2 * * * /bin/su - odoo -c "/bin/bash /home/odoo/backup.sh" >> /var/log/cron.log 2>&1 +10 2 * * * /bin/su - odoo -c ""/usr/bin/python /home/odoo/plan.py" >> /var/log/cron.log 2>&1 # empty line required at the end of this file for a valid cron file. - diff --git a/odoo/backups/launch.sh b/odoo/backups/launch.sh index 098b975..8fc147f 100644 --- a/odoo/backups/launch.sh +++ b/odoo/backups/launch.sh @@ -2,4 +2,4 @@ envsubst < /home/odoo/backup.template > /home/odoo/backup.sh chown odoo:odoo /home/odoo/backup.sh -touch /var/log/cron.log && cron && tail -f /var/log/cron.log +crontab ./crontab && touch /var/log/cron.log && cron && tail -f /var/log/cron.log