From 64bce71141d9562664c0a852dd096978579ea5f8 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Mon, 29 Mar 2010 12:28:31 +0000 Subject: main/postgresql: depend on client. added pg-restore init.d script New feature to restore backe up databases on bootup. Helps when you run postgresql databases from tmpfs. --- main/postgresql/pg-restore.initd | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 main/postgresql/pg-restore.initd (limited to 'main/postgresql/pg-restore.initd') diff --git a/main/postgresql/pg-restore.initd b/main/postgresql/pg-restore.initd new file mode 100644 index 0000000000..aaf07cbe7d --- /dev/null +++ b/main/postgresql/pg-restore.initd @@ -0,0 +1,31 @@ +#!/sbin/runscript + +opts="${opts} dump restore" + +depend() { + need postgresql +} + +restore() { + [ -z "$PGDUMP" ] && return 0 + ebegin "Restoring PostgreSQL $PGDUMP" + psql -U ${PG_USER:-postgres} ${PSQL_OPTS} -f "$PGDUMP" + eend $? + if [ -z "$KEEP_DUMP" ]; then + rm -f "$PGDUMP" + fi +} + +dump() { + [ -z "$PGDUMP" ] && return 0 + pg_dumpall -U ${PG_USER:-postgres} ${PG_DUMPALL_OPTS} -f "$PGDUMP" +} + +start() { + restore +} + +stop() { + dump +} + -- cgit v1.2.3