Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wal-g backup and restore command doenst work Ubuntu 22.04 due syntax issue #657

Closed
garry-t opened this issue May 13, 2024 · 3 comments
Closed

Comments

@garry-t
Copy link
Contributor

garry-t commented May 13, 2024

It is not clear why it doesnt work. Problem seems like here '%{http_code}'. I see that it marked was tested in Ubuntu 22.04.
Was wal-g also tested?

https://github.com/vitabaks/postgresql_cluster/blob/f59badf3513b3b7eac2ec4edfa11ff1ef72ac4ed/vars/main.yml#L483-L488
Tried with :
/bin/bash
/bin/sh
No reason, same issue.
syslog output CMD (sh -c 'curl -o /dev/null -s -w ")

@vitabaks
Copy link
Owner

Hi @garry-t

I will be grateful for PR if there is a mistake here and you manage to solve it.

I usually use pgbackrest and a simple check, for example:

if [ $(psql -tAXc 'select pg_is_in_recovery()') = 'f' ]; then pgbackrest --type=full --stanza={{ pgbackrest_stanza }} backup; fi

@vitabaks
Copy link
Owner

vitabaks commented May 13, 2024

please attach the cron job file located in /etc/cron.d/walg

@garry-t
Copy link
Contributor Author

garry-t commented May 13, 2024

Ok, understood.

cat /etc/cron.d/walg 
#Ansible: WAL-G: Create daily backup
30 3 * * * postgres  [ $(curl -s -o /dev/null -w '%{http_code}' http://IP:8008) = '200' ] && wal-g --config /var/lib/postgresql/.walg.json backup-push /var/lib/postgresql/15/main > /var/log/postgresql/walg_backup.log 2>&1
#Ansible: WAL-G: Delete old backups
30 6 * * * postgres  [ $(curl -s -o /dev/null -w '%{http_code}' http://IP:8008) = '200' ] && wal-g --config /var/lib/postgresql/.walg.json delete retain FULL 4 --confirm > /var/log/postgresql/walg_delete.log 2>&1

So I'll think how to solve it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@vitabaks @garry-t and others