summaryrefslogtreecommitdiffstats
path: root/main/postgresql/pg-restore.initd
blob: aaf07cbe7d9d7b976c0a5d2d970069d5e69f1484 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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
}