2020-05-17 08:25:07 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2024-01-08 07:59:05 +01:00
|
|
|
# Needed for cron and OBPLAN usage
|
|
|
|
printenv >> /etc/environment
|
|
|
|
|
2020-05-17 08:25:07 +02:00
|
|
|
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"
|
|
|
|
IFS=':' read -ra ODOO_ALT <<< "$ODOO_ALT"
|
|
|
|
for host in "${ODOO_HOST[@]}"
|
|
|
|
do
|
|
|
|
HOST=${host}
|
|
|
|
ADMIN_PASSWORD=${ODOO_ADMIN_PASSWORD[$index]}
|
|
|
|
DATABASES=${ODOO_DATABASES[$index]}
|
|
|
|
FMT=${ODOO_FMT[$index]:='zip'}
|
|
|
|
ALT=${ODOO_ALT[$index]:='no'}
|
|
|
|
export HOST ADMIN_PASSWORD DATABASES FMT ALT
|
|
|
|
envsubst < /home/odoo/backup.template >> /home/odoo/backup.sh
|
|
|
|
((index++))
|
|
|
|
done
|
2021-05-13 12:25:35 +02:00
|
|
|
if ! [ -z ${HC_URL} ]; then
|
|
|
|
envsubst < /home/odoo/hc.template >> /home/odoo/backup.sh
|
|
|
|
fi
|
2020-05-17 08:25:07 +02:00
|
|
|
chown odoo:odoo /home/odoo/backup.sh
|
|
|
|
crontab ./crontab && touch /var/log/cron.log && crond && tail -f /var/log/cron.log
|