[IMP]Odoo backup image can now be used for 1 or many hosts (fix problem with space in array)

This commit is contained in:
Fabien BOURGEOIS 2018-02-17 17:55:41 +01:00
parent cb91dda76a
commit 499e2019fc

View File

@ -3,14 +3,14 @@
set -f
echo '#!/bin/bash' > /home/odoo/backup.sh
index=0
ODOO_HOST=(${ODOO_HOST//:/ })
ODOO_ADMIN_PASSWORD=(${ODOO_ADMIN_PASSWORD//:/ })
ODOO_DATABASES=(${ODOO_DATABASES//:/ })
IFS=':' read -ra ODOO_HOST <<< "$ODOO_HOST"
IFS=':' read -ra ODOO_ADMIN_PASSWORD <<< "$ODOO_ADMIN_PASSWORD"
IFS=':' read -ra ODOO_DATABASES <<< "$ODOO_DATABASES"
for host in "${ODOO_HOST[@]}"
do
HOST=${host}
ADMIN_PASSWORD=${ODOO_ADMIN_PASSWORD[$index]}
DATABASE=${ODOO_DATABASES[$index]}
DATABASES=${ODOO_DATABASES[$index]}
export HOST ADMIN_PASSWORD DATABASES
envsubst < /home/odoo/backup.template >> /home/odoo/backup.sh
((index++))