diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2015-05-11 13:09:23 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2015-05-11 13:09:23 +0000 |
commit | 8e21b4e2b7fe9d38985cc9fab266808083aa4158 (patch) | |
tree | ed1c366897dca5024c13401c82c213db68b65561 /main/postgresql-bdr/pgbdr-restore.initd | |
parent | 367baf47c1effeb4fc05dd231d4b427da9f3f14d (diff) | |
download | aports-8e21b4e2b7fe9d38985cc9fab266808083aa4158.tar.bz2 aports-8e21b4e2b7fe9d38985cc9fab266808083aa4158.tar.xz |
main/postgresql-bdr*: move from testing
the conflict should be resolved now
Diffstat (limited to 'main/postgresql-bdr/pgbdr-restore.initd')
-rw-r--r-- | main/postgresql-bdr/pgbdr-restore.initd | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/main/postgresql-bdr/pgbdr-restore.initd b/main/postgresql-bdr/pgbdr-restore.initd new file mode 100644 index 0000000000..eef552bd5e --- /dev/null +++ b/main/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 +} |