diff options
author | Leonardo Arena <rnalrd@alpinelinux.org> | 2015-05-08 07:54:05 +0000 |
---|---|---|
committer | Leonardo Arena <rnalrd@alpinelinux.org> | 2015-05-08 07:54:54 +0000 |
commit | d1231930d4573229ab6c95b3c9b4852a5125d431 (patch) | |
tree | 6d7f80902cc23eadf13dd68b4fa68a76d0973e91 /testing/postgresql-bdr/pgbdr-restore.initd | |
parent | 336c258db7dffa3d12f2f00cf4524a578e4f48b3 (diff) | |
download | aports-d1231930d4573229ab6c95b3c9b4852a5125d431.tar.bz2 aports-d1231930d4573229ab6c95b3c9b4852a5125d431.tar.xz |
Revert "main/postgresql-{bdr,bdr-extension}: moved from testing"
This reverts commit 9a77d3fa7ad4acce0dc2b607df9a2218142cbb26.
Diffstat (limited to 'testing/postgresql-bdr/pgbdr-restore.initd')
-rw-r--r-- | testing/postgresql-bdr/pgbdr-restore.initd | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/testing/postgresql-bdr/pgbdr-restore.initd b/testing/postgresql-bdr/pgbdr-restore.initd new file mode 100644 index 0000000000..eef552bd5e --- /dev/null +++ b/testing/postgresql-bdr/pgbdr-restore.initd @@ -0,0 +1,36 @@ +#!/sbin/runscript + +extra_commands="${opts} dump restore purge" + +depend() { + need postgresql-bdr +} + +restore() { + yesno "$PGDUMP" && return 0 + ebegin "Restoring PostgreSQL $PGDUMP" + psql -U ${PG_USER:-postgres} ${PSQL_OPTS} -f "$PGDUMP" >/dev/null 2>/dev/null + local res=$? + yesno "$KEEP_DUMP" || rm -f "$PGDUMP" + eend $res + /etc/init.d/postgresql reload +} + +dump() { + yesno "$PGDUMP" && return 0 + mkdir -p "$( dirname "$PGDUMP" )" + ebegin "Saving PostgreSQL databases to $PGDUMP" + pg_dumpall -U ${PG_USER:-postgres} ${PG_DUMPALL_OPTS} -f "$PGDUMP" + eend $? +} + +purge() { + yesno "$PGDUMP" && return 0 + ebegin "Removing temporary $PGDUMP PostgreSQL backup" + rm -f "$PGDUMP" + eend $? +} + +start() { + restore +} |