post_backup_script barman-cloud-backup command not found when backup executed by cron

82 views
Skip to first unread message

Sharath Aradhyamath

unread,
May 23, 2023, 11:26:55 PM5/23/23
to Barman, Backup and Recovery Manager for PostgreSQL
Description:

i'm using post_backup_script to upload the basebackups to the azure. whenever the post_backup_script is executed due to backup cron job an error will be thrown saying "barman-cloud-backup: not found".
Barman docker image contains barman-cloud-backup binary and  post_backup_script will successfully execute barman-cloud-backup without command not found error when backup is taken manually.

Cron job

* * * * * barman /usr/local/bin/barman receive-wal --create-slot rrkibtest; /usr/local/bin/barman cron 2>&1 >> /var/log/barman/barman-cron.log
0 2 * * * barman /usr/local/bin/barman backup --wait --jobs 4 all 2>&1 >> /var/log/barman/barman-cron.log

------
Barman.log 

error message when post_backup_script is triggered due to backup cron job

2023-05-24 02:00:02,165 [540712] barman.backup_executor INFO: Starting backup copy via pg_basebackup for 20230524T020002
2023-05-24 02:00:02,173 [540712] barman.backup_executor INFO: pg_basebackup: initiating base backup, waiting for checkpoint to complete
2023-05-24 02:00:02,293 [112] barman.command_wrappers INFO: rrkibtest: pg_receivewal: finished segment at 0/78000000 (timeline 1)
2023-05-24 02:00:02,312 [540712] barman.backup_executor INFO: pg_basebackup: checkpoint completed
2023-05-24 02:00:02,459 [540720] barman.wal_archiver INFO: Found 1 xlog segments from streaming for rrkibtest. Archive all segments in one run.
2023-05-24 02:00:02,459 [540720] barman.wal_archiver INFO: Archiving segment 1 of 1 from streaming: rrkibtest/000000010000000000000077
2023-05-24 02:00:25,207 [540712] barman.backup_executor INFO: NOTICE: WAL archiving is not enabled; you must ensure that all required WAL segments are copied through other means to complete
the backup
2023-05-24 02:00:25,210 [540712] barman.backup_executor INFO: pg_basebackup: syncing data to disk ...
2023-05-24 02:00:25,347 [112] barman.command_wrappers INFO: rrkibtest: pg_receivewal: finished segment at 0/79000000 (timeline 1)
2023-05-24 02:00:26,915 [540712] barman.backup_executor INFO: pg_basebackup: renaming backup_manifest.tmp to backup_manifest
2023-05-24 02:00:26,920 [540712] barman.backup_executor INFO: pg_basebackup: base backup completed
2023-05-24 02:00:26,921 [540712] barman.backup_executor INFO:
2023-05-24 02:00:26,923 [540712] barman.backup_executor INFO: Copy done (time: 24 seconds)
2023-05-24 02:00:26,925 [540712] barman.backup_executor INFO: Finalising the backup.
2023-05-24 02:00:26,941 [540712] barman.postgres INFO: Restore point 'barman_20230524T020002' successfully created
2023-05-24 02:00:27,713 [540712] barman.backup INFO: Backup size: 88.3 MiB

...skipping 1 line
2023-05-24 02:00:27,715 [540712] barman.backup INFO: Backup completed (start time: 2023-05-24 02:00:02.165356, elapsed time: 25 seconds)
2023-05-24 02:00:27,716 [540712] barman.server INFO: Waiting for the WAL file 000000010000000000000078 from server 'rrkibtest'
2023-05-24 02:00:27,717 [540712] barman.wal_archiver INFO: Found 1 xlog segments from streaming for rrkibtest. Archive all segments in one run.
2023-05-24 02:00:27,718 [540712] barman.wal_archiver INFO: Archiving segment 1 of 1 from streaming: rrkibtest/000000010000000000000078
2023-05-24 02:00:27,853 [540712] Command WARNING: /bin/sh: 1: barman-cloud-backup: not found
2023-05-24 02:00:27,853 [540712] barman.hooks WARNING: barman-cloud-backup --cloud-provider azure-blob-storage https://rrbarman.blob.core.windows.net/rrkibtest rrkibtest returned 127
Output details:
/bin/sh: 1: barman-cloud-backup: not found

2023-05-24 02:00:27,854 [540712] barman.wal_archiver INFO: No xlog segments found from streaming for rrkibtest.
2023-05-24 02:01:02,041 [540729] barman.server INFO: Creating physical replication slot 'barman' on server 'rrkibtest'
2023-05-24 02:01:02,042 [540729] barman.server ERROR: Replication slot 'barman' already exists
2023-05-24 02:01:02,225 [540731] barman.backup INFO: Enforcing retention policy: removing backup 20230517T020001 for server rrkibtest
2023-05-24 02:01:02,227 [540731] barman.backup INFO: Deleting backup 20230517T020001 for server rrkibtest
2023-05-24 02:01:02,281 [540731] barman.backup INFO: Delete associated WAL segments:
2023-05-24 02:01:02,290 [540731] barman.backup INFO: 00000001000000000000006A
2023-05-24 02:01:02,290 [540731] barman.backup INFO: 00000001000000000000006B
2023-05-24 02:01:02,291 [540731] barman.backup INFO: Deleted backup 20230517T020001 (start time: Wed May 24 02:01:02 2023, elapsed time: less than one second)

post_backup_script successfully execute barman-cloud-backup when the backup is triggered manually.

backup --wait --jobs 4 all


2023-05-24 03:14:29,067 [541627] barman.backup INFO: Starting backup using postgres method for server rrkibtest in /var/lib/barman/rrkibtest/base/20230524T031429
2023-05-24 03:14:29,075 [541627] barman.backup_executor INFO: Backup start at LSN: 0/810000C8 (000000010000000000000081, 000000C8)
2023-05-24 03:14:29,075 [541627] barman.backup_executor INFO: Starting backup copy via pg_basebackup for 20230524T031429
2023-05-24 03:14:29,083 [541627] barman.backup_executor INFO: could not change directory to "/root": Permission denied
2023-05-24 03:14:29,085 [541627] barman.backup_executor INFO: pg_basebackup: initiating base backup, waiting for checkpoint to complete
2023-05-24 03:14:29,202 [112] barman.command_wrappers INFO: rrkibtest: pg_receivewal: finished segment at 0/82000000 (timeline 1)
2023-05-24 03:14:29,238 [541627] barman.backup_executor INFO: pg_basebackup: checkpoint completed
2023-05-24 03:14:52,151 [541627] barman.backup_executor INFO: NOTICE: WAL archiving is not enabled; you must ensure that all required WAL segments are copied through other means to complete the backup
2023-05-24 03:14:52,153 [541627] barman.backup_executor INFO: pg_basebackup: syncing data to disk ...
2023-05-24 03:14:52,278 [112] barman.command_wrappers INFO: rrkibtest: pg_receivewal: finished segment at 0/83000000 (timeline 1)
2023-05-24 03:14:53,791 [541627] barman.backup_executor INFO: pg_basebackup: renaming backup_manifest.tmp to backup_manifest
2023-05-24 03:14:53,796 [541627] barman.backup_executor INFO: pg_basebackup: base backup completed
2023-05-24 03:14:53,797 [541627] barman.backup_executor INFO:
2023-05-24 03:14:53,799 [541627] barman.backup_executor INFO: Copy done (time: 24 seconds)
2023-05-24 03:14:53,801 [541627] barman.backup_executor INFO: Finalising the backup.
2023-05-24 03:14:53,808 [541627] barman.postgres INFO: Restore point 'barman_20230524T031429' successfully created
2023-05-24 03:14:54,528 [541627] barman.backup INFO: Backup size: 88.3 MiB
2023-05-24 03:14:54,529 [541627] barman.backup INFO: Backup end at LSN: 0/83000000 (000000010000000000000082, 00000000)
2023-05-24 03:14:54,531 [541627] barman.backup INFO: Backup completed (start time: 2023-05-24 03:14:29.075777, elapsed time: 25 seconds)
2023-05-24 03:14:54,532 [541627] barman.server INFO: Waiting for the WAL file 000000010000000000000082 from server 'rrkibtest'
2023-05-24 03:14:54,535 [541627] barman.wal_archiver INFO: Found 2 xlog segments from streaming for rrkibtest. Archive all segments in one run.
2023-05-24 03:14:54,535 [541627] barman.wal_archiver INFO: Archiving segment 1 of 2 from streaming: rrkibtest/000000010000000000000081
2023-05-24 03:14:54,640 [541627] barman.wal_archiver INFO: Archiving segment 2 of 2 from streaming: rrkibtest/000000010000000000000082
2023-05-24 03:15:01,644 [541651] barman.server INFO: Creating physical replication slot 'barman' on server 'rrkibtest'
2023-05-24 03:15:01,645 [541651] barman.server ERROR: Replication slot 'barman' already exists
2023-05-24 03:15:01,829 [541653] barman.backup INFO: Enforcing retention policy: removing backup 20230521T020001 for server rrkibtest
2023-05-24 03:15:01,831 [541653] barman.backup INFO: Deleting backup 20230521T020001 for server rrkibtest
2023-05-24 03:15:01,886 [541653] barman.backup INFO: Delete associated WAL segments:
2023-05-24 03:15:01,895 [541653] barman.backup INFO: 000000010000000000000072
2023-05-24 03:15:01,896 [541653] barman.backup INFO: 000000010000000000000073
2023-05-24 03:15:01,897 [541653] barman.backup INFO: Deleted backup 20230521T020001 (start time: Wed May 24 03:15:01 2023, elapsed time: less than one second)

---

barman.conf

; Pre/post backup hook scripts
;pre_backup_script = env | grep ^BARMAN
;pre_backup_retry_script = env | grep ^BARMAN
;post_backup_retry_script = env | grep ^BARMAN
post_backup_script = 'barman-cloud-backup --cloud-provider azure-blob-storage https://<storage-account>.blob.core.windows.net/rrkibtest rrkibtest'

---
root@edge07:~# barman check all
Server rrkibtest:
PostgreSQL: OK
superuser or standard user with backup privileges: OK
PostgreSQL streaming: OK
wal_level: OK
replication slot: OK
directories: OK
retention policy settings: OK
backup maximum age: OK (interval provided: 7 days, latest backup age: 7 minutes, 19 seconds)
backup minimum size: OK (88.3 MiB)
wal maximum age: OK (no last_wal_maximum_age provided)
wal size: OK (0 B)
compression settings: OK
failed backups: OK (there are 0 failed backups)
minimum redundancy requirements: OK (have 7 backups, expected at least 0)
pg_basebackup: OK
pg_basebackup compatible: OK
pg_basebackup supports tablespaces mapping: OK
systemid coherence: OK
pg_receivexlog: OK
pg_receivexlog compatible: OK
receive-wal running: OK
archiver errors: OK

---

# barman diagnose
{
"global": {
"config": {
"backup_options": "concurrent_backup",
"bandwidth_limit": "4000",
"barman_home": "/var/lib/barman",
"barman_user": "barman",
"compression": "gzip",
"configuration_files_directory": "/etc/barman/barman.d",
"description": "Barman configuration",
"errors_list": [],
"last_backup_maximum_age": "1 week",
"log_file": "/var/log/barman/barman.log",
"log_level": "INFO",
"network_compression": "false",
"post_backup_script": "'barman-cloud-backup --cloud-provider azure-blob-storage https://rrbarman.blob.core.windows.net/rrkibtest rrkibtest'",
"retention_policy": "REDUNDANCY 7",
"retention_policy_mode": "auto",
"streaming_archiver": "on",
"wal_retention_policy": "main"
},
"system_info": {
"barman_ver": "3.5.0",
"kernel_ver": "Linux edge07 5.4.0-144-generic #161-Ubuntu SMP Fri Feb 3 14:49:04 UTC 2023 x86_64 GNU/Linux",
"python_ver": "",
"release": "Distributor ID:\tDebian\nDescription:\tDebian GNU/Linux 11 (bullseye)\nRelease:\t11\nCodename:\tbullseye",
"rsync_ver": "rsync version 3.2.3 protocol version 31",
"ssh_ver": "",
"timestamp": "2023-05-24T03:23:02.488793+00:00"
}
},
"servers": {
"rrkibtest": {
"backups": {
"20230522T020001": {
"backup_id": "20230522T020001",
"backup_label": "'START WAL LOCATION: 0/74000028 (file 000000010000000000000074)\\nCHECKPOINT LOCATION: 0/74000060\\nBACKUP METHOD: streamed\\nBACKUP FROM: primary\\nSTART TIME: 2023-05-22 02:00:01 UTC\\nLABEL: pg_basebackup base backup\\nSTART TIMELINE: 1\\n'",
"begin_offset": 40,
"begin_time": "2023-05-22T02:00:01.586425+00:00",
"begin_wal": "000000010000000000000074",
"begin_xlog": "0/74000028",
"compression": null,
"config_file": "/var/lib/postgresql/data/postgresql.conf",
"copy_stats": {
"copy_time": 24.644607,
"total_time": 24.644607
},
"deduplicated_size": 92544970,
"end_offset": 0,
"end_time": "2023-05-22T02:00:26.246426+00:00",
"end_wal": "000000010000000000000074",
"end_xlog": "0/75000000",
"error": null,
"hba_file": "/var/lib/postgresql/data/pg_hba.conf",
"ident_file": "/var/lib/postgresql/data/pg_ident.conf",
"included_files": null,
"mode": "postgres",
"pgdata": "/var/lib/postgresql/data",
"server_name": "rrkibtest",
"size": 92544970,
"status": "DONE",
"systemid": "7219185200325750823",
"tablespaces": null,
"timeline": 1,
"version": 150002,
"xlog_segment_size": 16777216
},
"20230523T020001": {
"backup_id": "20230523T020001",
"backup_label": "'START WAL LOCATION: 0/76000028 (file 000000010000000000000076)\\nCHECKPOINT LOCATION: 0/76000060\\nBACKUP METHOD: streamed\\nBACKUP FROM: primary\\nSTART TIME: 2023-05-23 02:00:01 UTC\\nLABEL: pg_basebackup base backup\\nSTART TIMELINE: 1\\n'",
"begin_offset": 40,
"begin_time": "2023-05-23T02:00:01.750607+00:00",
"begin_wal": "000000010000000000000076",
"begin_xlog": "0/76000028",
"compression": null,
"config_file": "/var/lib/postgresql/data/postgresql.conf",
"copy_stats": {
"copy_time": 24.771781,
"total_time": 24.771781
},
"deduplicated_size": 92544970,
"end_offset": 0,
"end_time": "2023-05-23T02:00:26.537041+00:00",
"end_wal": "000000010000000000000076",
"end_xlog": "0/77000000",
"error": null,
"hba_file": "/var/lib/postgresql/data/pg_hba.conf",
"ident_file": "/var/lib/postgresql/data/pg_ident.conf",
"included_files": null,
"mode": "postgres",
"pgdata": "/var/lib/postgresql/data",
"server_name": "rrkibtest",
"size": 92544970,
"status": "DONE",
"systemid": "7219185200325750823",
"tablespaces": null,
"timeline": 1,
"version": 150002,
"xlog_segment_size": 16777216
},
"20230524T020002": {
"backup_id": "20230524T020002",
"backup_label": "'START WAL LOCATION: 0/78000028 (file 000000010000000000000078)\\nCHECKPOINT LOCATION: 0/78000060\\nBACKUP METHOD: streamed\\nBACKUP FROM: primary\\nSTART TIME: 2023-05-24 02:00:02 UTC\\nLABEL: pg_basebackup base backup\\nSTART TIMELINE: 1\\n'",
"begin_offset": 40,
"begin_time": "2023-05-24T02:00:02.160471+00:00",
"begin_wal": "000000010000000000000078",
"begin_xlog": "0/78000028",
"compression": null,
"config_file": "/var/lib/postgresql/data/postgresql.conf",
"copy_stats": {
"copy_time": 24.756467,
"total_time": 24.756467
},
"deduplicated_size": 92544970,
"end_offset": 0,
"end_time": "2023-05-24T02:00:26.932040+00:00",
"end_wal": "000000010000000000000078",
"end_xlog": "0/79000000",
"error": null,
"hba_file": "/var/lib/postgresql/data/pg_hba.conf",
"ident_file": "/var/lib/postgresql/data/pg_ident.conf",
"included_files": null,
"mode": "postgres",
"pgdata": "/var/lib/postgresql/data",
"server_name": "rrkibtest",
"size": 92544970,
"status": "DONE",
"systemid": "7219185200325750823",
"tablespaces": null,
"timeline": 1,
"version": 150002,
"xlog_segment_size": 16777216
},
"20230524T030301": {
"backup_id": "20230524T030301",
"backup_label": "'START WAL LOCATION: 0/7A000028 (file 00000001000000000000007A)\\nCHECKPOINT LOCATION: 0/7A000060\\nBACKUP METHOD: streamed\\nBACKUP FROM: primary\\nSTART TIME: 2023-05-24 03:03:01 UTC\\nLABEL: pg_basebackup base backup\\nSTART TIMELINE: 1\\n'",
"begin_offset": 40,
"begin_time": "2023-05-24T03:03:01.081207+00:00",
"begin_wal": "00000001000000000000007A",
"begin_xlog": "0/7A000028",
"compression": null,
"config_file": "/var/lib/postgresql/data/postgresql.conf",
"copy_stats": {
"copy_time": 24.891156,
"total_time": 24.891156
},
"deduplicated_size": 92544970,
"end_offset": 96,
"end_time": "2023-05-24T03:03:25.991857+00:00",
"end_wal": "00000001000000000000007B",
"end_xlog": "0/7B000060",
"error": null,
"hba_file": "/var/lib/postgresql/data/pg_hba.conf",
"ident_file": "/var/lib/postgresql/data/pg_ident.conf",
"included_files": null,
"mode": "postgres",
"pgdata": "/var/lib/postgresql/data",
"server_name": "rrkibtest",
"size": 92544970,
"status": "DONE",
"systemid": "7219185200325750823",
"tablespaces": null,
"timeline": 1,
"version": 150002,
"xlog_segment_size": 16777216
},
"20230524T030929": {
"backup_id": "20230524T030929",
"backup_label": "'START WAL LOCATION: 0/7D000028 (file 00000001000000000000007D)\\nCHECKPOINT LOCATION: 0/7D000060\\nBACKUP METHOD: streamed\\nBACKUP FROM: primary\\nSTART TIME: 2023-05-24 03:09:29 UTC\\nLABEL: pg_basebackup base backup\\nSTART TIMELINE: 1\\n'",
"begin_offset": 40,
"begin_time": "2023-05-24T03:09:29.256503+00:00",
"begin_wal": "00000001000000000000007D",
"begin_xlog": "0/7D000028",
"compression": null,
"config_file": "/var/lib/postgresql/data/postgresql.conf",
"copy_stats": {
"copy_time": 24.73345,
"total_time": 24.73345
},
"deduplicated_size": 92544970,
"end_offset": 96,
"end_time": "2023-05-24T03:09:54.001693+00:00",
"end_wal": "00000001000000000000007E",
"end_xlog": "0/7E000060",
"error": null,
"hba_file": "/var/lib/postgresql/data/pg_hba.conf",
"ident_file": "/var/lib/postgresql/data/pg_ident.conf",
"included_files": null,
"mode": "postgres",
"pgdata": "/var/lib/postgresql/data",
"server_name": "rrkibtest",
"size": 92544970,
"status": "DONE",
"systemid": "7219185200325750823",
"tablespaces": null,
"timeline": 1,
"version": 150002,
"xlog_segment_size": 16777216
},
"20230524T031228": {
"backup_id": "20230524T031228",
"backup_label": "'START WAL LOCATION: 0/80000028 (file 000000010000000000000080)\\nCHECKPOINT LOCATION: 0/80000060\\nBACKUP METHOD: streamed\\nBACKUP FROM: primary\\nSTART TIME: 2023-05-24 03:12:28 UTC\\nLABEL: pg_basebackup base backup\\nSTART TIMELINE: 1\\n'",
"begin_offset": 40,
"begin_time": "2023-05-24T03:12:28.638997+00:00",
"begin_wal": "000000010000000000000080",
"begin_xlog": "0/80000028",
"compression": null,
"config_file": "/var/lib/postgresql/data/postgresql.conf",
"copy_stats": {
"copy_time": 24.818598,
"total_time": 24.818598
},
"deduplicated_size": 92544970,
"end_offset": 0,
"end_time": "2023-05-24T03:12:53.473035+00:00",
"end_wal": "000000010000000000000080",
"end_xlog": "0/81000000",
"error": null,
"hba_file": "/var/lib/postgresql/data/pg_hba.conf",
"ident_file": "/var/lib/postgresql/data/pg_ident.conf",
"included_files": null,
"mode": "postgres",
"pgdata": "/var/lib/postgresql/data",
"server_name": "rrkibtest",
"size": 92544970,
"status": "DONE",
"systemid": "7219185200325750823",
"tablespaces": null,
"timeline": 1,
"version": 150002,
"xlog_segment_size": 16777216
},
"20230524T031429": {
"backup_id": "20230524T031429",
"backup_label": "'START WAL LOCATION: 0/82000028 (file 000000010000000000000082)\\nCHECKPOINT LOCATION: 0/82000060\\nBACKUP METHOD: streamed\\nBACKUP FROM: primary\\nSTART TIME: 2023-05-24 03:14:29 UTC\\nLABEL: pg_basebackup base backup\\nSTART TIMELINE: 1\\n'",
"begin_offset": 40,
"begin_time": "2023-05-24T03:14:29.071978+00:00",
"begin_wal": "000000010000000000000082",
"begin_xlog": "0/82000028",
"compression": null,
"config_file": "/var/lib/postgresql/data/postgresql.conf",
"copy_stats": {
"copy_time": 24.722093,
"total_time": 24.722093
},
"deduplicated_size": 92544970,
"end_offset": 0,
"end_time": "2023-05-24T03:14:53.805185+00:00",
"end_wal": "000000010000000000000082",
"end_xlog": "0/83000000",
"error": null,
"hba_file": "/var/lib/postgresql/data/pg_hba.conf",
"ident_file": "/var/lib/postgresql/data/pg_ident.conf",
"included_files": null,
"mode": "postgres",
"pgdata": "/var/lib/postgresql/data",
"server_name": "rrkibtest",
"size": 92544970,
"status": "DONE",
"systemid": "7219185200325750823",
"tablespaces": null,
"timeline": 1,
"version": 150002,
"xlog_segment_size": 16777216
}
},
"config": {
"active": true,
"archiver": false,
"archiver_batch_size": 0,
"backup_compression": null,
"backup_compression_format": null,
"backup_compression_level": null,
"backup_compression_location": null,
"backup_compression_workers": null,
"backup_directory": "/var/lib/barman/rrkibtest",
"backup_method": "postgres",
"backup_options": "concurrent_backup",
"bandwidth_limit": 4000,
"barman_home": "/var/lib/barman",
"barman_lock_directory": "/var/lib/barman",
"basebackup_retry_sleep": 30,
"basebackup_retry_times": 0,
"basebackups_directory": "/var/lib/barman/rrkibtest/base",
"check_timeout": 30,
"compression": "gzip",
"conninfo": "host=localhost user=postgres dbname=postgres application_name=postgresql",
"create_slot": "auto",
"custom_compression_filter": null,
"custom_compression_magic": null,
"custom_decompression_filter": null,
"description": "PostgreSQL Database (Streaming-Only)",
"disabled": false,
"errors_directory": "/var/lib/barman/rrkibtest/errors",
"forward_config_path": false,
"immediate_checkpoint": false,
"incoming_wals_directory": "/var/lib/barman/rrkibtest/incoming",
"last_backup_maximum_age": "7 days",
"last_backup_minimum_size": null,
"last_wal_maximum_age": null,
"max_incoming_wals_queue": null,
"minimum_redundancy": 0,
"msg_list": [],
"name": "rrkibtest",
"network_compression": false,
"parallel_jobs": 1,
"parallel_jobs_start_batch_period": 1,
"parallel_jobs_start_batch_size": 10,
"path_prefix": "/usr/lib/postgresql/15/bin",
"post_archive_retry_script": null,
"post_archive_script": null,
"post_backup_retry_script": null,
"post_backup_script": "barman-cloud-backup --cloud-provider azure-blob-storage https://<storage-accoount>.blob.core.windows.net/rrkibtest rrkibtest",
"post_delete_retry_script": null,
"post_delete_script": null,
"post_recovery_retry_script": null,
"post_recovery_script": null,
"post_wal_delete_retry_script": null,
"post_wal_delete_script": null,
"pre_archive_retry_script": null,
"pre_archive_script": null,
"pre_backup_retry_script": null,
"pre_backup_script": null,
"pre_delete_retry_script": null,
"pre_delete_script": null,
"pre_recovery_retry_script": null,
"pre_recovery_script": null,
"pre_wal_delete_retry_script": null,
"pre_wal_delete_script": null,
"primary_conninfo": null,
"primary_ssh_command": null,
"recovery_options": "",
"recovery_staging_path": null,
"retention_policy": "redundancy 7 b",
"retention_policy_mode": "auto",
"reuse_backup": null,
"slot_name": "barman",
"snapshot_disks": null,
"snapshot_gcp_project": null,
"snapshot_instance": null,
"snapshot_provider": null,
"snapshot_zone": null,
"ssh_command": null,
"streaming_archiver": true,
"streaming_archiver_batch_size": 0,
"streaming_archiver_name": "barman_receive_wal",
"streaming_backup_name": "barman_streaming_backup",
"streaming_conninfo": "host=localhost user=barman application_name=postgresql",
"streaming_wals_directory": "/var/lib/barman/rrkibtest/streaming",
"tablespace_bandwidth_limit": null,
"wal_retention_policy": "simple-wal 7 b",
"wals_directory": "/var/lib/barman/rrkibtest/wals"
},
"status": {
"archive_timeout": 0,
"checkpoint_timeout": 300,
"config_file": "/var/lib/postgresql/data/postgresql.conf",
"connection_error": null,
"current_lsn": "0/830001B0",
"current_size": 91996623.0,
"current_xlog": "000000010000000000000083",
"data_checksums": "off",
"data_directory": "/var/lib/postgresql/data",
"has_backup_privileges": true,
"hba_file": "/var/lib/postgresql/data/pg_hba.conf",
"hot_standby": "on",
"ident_file": "/var/lib/postgresql/data/pg_ident.conf",
"is_in_recovery": false,
"is_superuser": true,
"max_replication_slots": "10",
"max_wal_senders": "10",
"pg_basebackup_bwlimit": true,
"pg_basebackup_compatible": true,
"pg_basebackup_installed": true,
"pg_basebackup_path": "/usr/lib/postgresql/15/bin/pg_basebackup",
"pg_basebackup_tbls_mapping": true,
"pg_basebackup_version": "15.2",
"pg_receivexlog_compatible": true,
"pg_receivexlog_installed": true,
"pg_receivexlog_path": "/usr/lib/postgresql/15/bin/pg_receivewal",
"pg_receivexlog_supports_slots": true,
"pg_receivexlog_synchronous": false,
"pg_receivexlog_version": "15.2",
"postgres_systemid": "7219185200325750823",
"replication_slot": [
"barman",
true,
"0/83000000"
],
"replication_slot_support": true,
"server_txt_version": "15.2",
"streaming": true,
"streaming_supported": true,
"streaming_systemid": "7219185200325750823",
"synchronous_standby_names": [
""
],
"timeline": 1,
"version_supported": true,
"wal_compression": "off",
"wal_keep_size": "0",
"wal_level": "logical",
"xlog_segment_size": 16777216,
"xlogpos": "0/830001B0"
},
"wals": {
"last_archived_wal_per_timeline": {
"00000001": {
"compression": "gzip",
"name": "000000010000000000000082",
"size": 16489,
"time": 1684898092.1663668
}
}
}
}
}
}

Alnis Morics

unread,
May 24, 2023, 1:50:42 AM5/24/23
to pgba...@googlegroups.com
Hello,

Maybe try to put full path of barman-cloud-backup into barman.conf, for
example:

post_backup_script = '/usr/bin/barman-cloud-backup --cloud-provider
azure-blob-storage
https://<storage-account>.blob.core.windows.net/rrkibtest rrkibtest'

(If /usr/bin/ is the directory where barman-cloud-backup is found on
your system)

Because it's read from cron environmment, which is often different.

On 5/24/23 06:26, Sharath Aradhyamath wrote:
> *Description:*
>
> i'm using *post_backup_script *to upload the basebackups to the azure.
> whenever the *post_backup_script *is executed due to _/backup cron
> job/_ an error will be thrown saying "*barman-cloud-backup: not found*".
> Barman docker image contains *barman-cloud-backup *binary and
> *post_backup_script *will successfully execute *barman-cloud-backup
> *without _command not found error_**when _backup is taken manually._
>
> _*Cron job*_
> _
> _
> * * * * * barman /usr/local/bin/barman receive-wal --create-slot
> rrkibtest; /usr/local/bin/barman cron 2>&1 >>
> /var/log/barman/barman-cron.log
> 0 2 * * * barman /usr/local/bin/barman backup --wait --jobs 4 all 2>&1
> >> /var/log/barman/barman-cron.log
>
> ------
> *_Barman.log_ *
>
> error message when *post_backup_script *is triggered due to backup
> *post_backup_script *successfully execute barman-cloud-backup when the
> --
> --
> You received this message because you are subscribed to the "Barman
> for PostgreSQL" group.
> To post to this group, send email to pgba...@googlegroups.com
> To unsubscribe from this group, send email to
> pgbarman+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/pgbarman?hl=en?hl=en-GB
>
> ---
> You received this message because you are subscribed to the Google
> Groups "Barman, Backup and Recovery Manager for PostgreSQL" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to pgbarman+u...@googlegroups.com.
> To view this discussion on the web, visit
> https://groups.google.com/d/msgid/pgbarman/b0b67f36-6aac-4710-b694-767afb6f7497n%40googlegroups.com
> <https://groups.google.com/d/msgid/pgbarman/b0b67f36-6aac-4710-b694-767afb6f7497n%40googlegroups.com?utm_medium=email&utm_source=footer>.
Reply all
Reply to author
Forward
0 new messages