wal-g/templates/backup.sh.j2
2023-05-11 13:56:29 +03:00

13 lines
562 B
Django/Jinja

exec 200>/tmp/backup.lock
flock -x 200
role=$(curl -k -s http://127.0.0.1:8008 || curl -k -s https://127.0.0.1:8008 | jq '.role')
if [ "${role}" == "\"master\"" ] ; then
{% if wal_g_http_proxy is defined %}http_proxy={{ wal_g_http_proxy }} {% else %}{% endif %}{% if wal_g_https_proxy is defined %}https_proxy={{ wal_g_https_proxy }} {% else %}{% endif %}{{ wal_g_pg_binary_name }} --config {{ wal_g_pg_home_dir }}/{{ wal_g_config_name }} backup-push {{ wal_g_pg_data_dir }} --full 2>&1 | tee -a /var/log/postgresql/backup.log
else
echo ""
fi
exec 200>&-