Skip to content

Commit c6306db

Browse files
committed
Add 'basebackup_to_shell' contrib module.
As a demonstration of the sort of thing that can be done by adding a custom backup target, this defines a 'shell' target which executes a command defined by the system administrator. The command is executed once for each tar archive generate by the backup and once for the backup manifest, if any. Each time the command is executed, it receives the contents of th file for which it is executed via standard input. The configured command can use %f to refer to the name of the archive (e.g. base.tar, $TABLESPACE_OID.tar, backup_manifest) and %d to refer to the target detail (pg_basebackup --target shell:DETAIL). A target detail is required if %d appears in the configured command and forbidden if it does not. Patch by me, reviewed by Abhijit Menon-Sen. Discussion: http://postgr.es/m/CA+TgmoaqvdT-u3nt+_kkZ7bgDAyqDB0i-+XOMmr5JN2Rd37hxw@mail.gmail.com
1 parent e4ba69f commit c6306db

File tree

6 files changed

+510
-0
lines changed

6 files changed

+510
-0
lines changed

contrib/Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ SUBDIRS = \
1010
auth_delay \
1111
auto_explain \
1212
basic_archive \
13+
basebackup_to_shell \
1314
bloom \
1415
btree_gin \
1516
btree_gist \

contrib/basebackup_to_shell/Makefile

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# contrib/basebackup_to_shell/Makefile
2+
3+
MODULE_big = basebackup_to_shell
4+
OBJS = \
5+
$(WIN32RES) \
6+
basebackup_to_shell.o
7+
8+
PGFILEDESC = "basebackup_to_shell - target basebackup to shell command"
9+
10+
ifdef USE_PGXS
11+
PG_CONFIG = pg_config
12+
PGXS := $(shell $(PG_CONFIG) --pgxs)
13+
include $(PGXS)
14+
else
15+
subdir = contrib/basebackup_to_shell
16+
top_builddir = ../..
17+
include $(top_builddir)/src/Makefile.global
18+
include $(top_srcdir)/contrib/contrib-global.mk
19+
endif

0 commit comments

Comments
 (0)