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 {{ wal_g_pg_binary_name }} retain {{ wal_g_backup_retention_number }} --confirm --use-sentinel-time 2>&1 | tee -a /var/log/postgresql/backup-retention.log else echo "" fi exec 200>&-