Project

General

Profile

« Previous | Next » 

Revision 13288

lib/sh/db.sh: pg_snapshot(): perform online backup if possible, to avoid needing to restart the server

View differences:

trunk/lib/sh/db.sh
435 435
pg_snapshot() # usage: [live=] [from=...] [to=...] pg_snapshot rsync_opts...
436 436
{
437 437
	echo_func; kw_params from to; local from="${from:-/var/lib/postgresql}"
438
	ctl=pg_ctl db_snapshot "$@"
438
	
439
	if pg_start_backup; then # perform online backup
440
		try db_copy "$@"
441
		pg_stop_backup
442
		end_try
443
	else ctl=pg_ctl db_snapshot "$@" # fall back to stopping server
444
	fi
439 445
}
440 446

  
441 447
fi

Also available in: Unified diff