2023-02-07 23:18:19 +00:00
|
|
|
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')
|
|
|
|
|
2023-07-03 21:02:28 +00:00
|
|
|
if [ "${role}" == "\"master\"" ] || [ "${role}" == "" ]; then
|
2023-05-19 09:00:52 +00:00
|
|
|
{% 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 }} {% elif wal_g_http_proxy is defined %}https_proxy={{ wal_g_http_proxy }}{% else %}{% endif %} {{ wal_g_pg_binary_name }} --config {{ wal_g_pg_home_dir }}/{{ wal_g_config_name }} retain {{ wal_g_backup_retention_number }} --confirm --use-sentinel-time 2>&1 | tee -a /var/log/postgresql/backup-retention.log
|
2023-02-07 23:18:19 +00:00
|
|
|
else
|
|
|
|
echo ""
|
|
|
|
fi
|
|
|
|
|
|
|
|
exec 200>&-
|