docker_images/odoo/backups/launch.sh

22 lines
686 B
Bash
Raw Normal View History

2016-10-05 08:56:58 +02:00
#!/bin/bash
set -f
echo '#!/bin/bash' > /home/odoo/backup.sh
index=0
IFS=':' read -ra ODOO_HOST <<< "$ODOO_HOST"
IFS=':' read -ra ODOO_ADMIN_PASSWORD <<< "$ODOO_ADMIN_PASSWORD"
IFS=':' read -ra ODOO_DATABASES <<< "$ODOO_DATABASES"
IFS=':' read -ra ODOO_FMT <<< "$ODOO_FMT"
for host in "${ODOO_HOST[@]}"
do
HOST=${host}
ADMIN_PASSWORD=${ODOO_ADMIN_PASSWORD[$index]}
DATABASES=${ODOO_DATABASES[$index]}
FMT=${ODOO_FMT[$index]:='zip'}
export HOST ADMIN_PASSWORD DATABASES FMT
envsubst < /home/odoo/backup.template >> /home/odoo/backup.sh
((index++))
done
2016-10-05 08:56:58 +02:00
chown odoo:odoo /home/odoo/backup.sh
crontab ./crontab && touch /var/log/cron.log && cron && tail -f /var/log/cron.log