postgres-backup

command module
v0.0.0-...-112ccd8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 14, 2026 License: BSD-2-Clause Imports: 13 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Postgres Backup Cron

Install

go get github.com/bborbe/postgres-backup

Run Backup

One time

postgres-backup \
-logtostderr \
-v=2 \
-host=localhost \
-port=5432 \
-lock=/tmp/lock \ 
-username=postgres \
-password=S3CR3T \
-database=db \
-targetdir=/backup \
-name=postgres \
-one-time

Cron

postgres-backup \
-logtostderr \
-v=2 \
-host=localhost \
-port=5432 \
-lock=/tmp/lock \ 
-username=postgres \
-password=S3CR3T \
-database=db \
-targetdir=/backup \
-name=postgres \
-wait=1h

Start Postgres

docker run \
--name db \
--env POSTGRES_DB=mydb \
--env POSTGRES_USER=myuser \
--env POSTGRES_PASSWORD=mypassword \
--env PGDATA=/var/lib/postgresql/data/pgdata \
postgres:9.6.1-alpine

Backup once with Docker

docker run \
--env HOST=db \
--env PORT=5432 \
--env DATABASE=mydb \
--env USERNAME=myuser \
--env PASSWORD=mypassword \
--env ONE_TIME=true \
--env LOCK=/postgres_backup_cron.lock \
--env TARGETDIR=/backup \
--volume /tmp:/backup \
--link db:db \
bborbe/postgres-backup:latest \
-logtostderr \
-v=1

ls /tmp/postgres_mydb_*.dump

Backup every hour with Docker

docker run \
--env HOST=db \
--env PORT=5432 \
--env DATABASE=mydb \
--env USERNAME=myuser \
--env PASSWORD=mypassword \
--env WAIT=1h \
--env ONE_TIME=false \
--env LOCK=/postgres_backup_cron.lock \
--env TARGETDIR=/backup \
--volume /tmp:/backup \
--link db:db \
bborbe/postgres-backup:latest \
-logtostderr \
-v=1

ls /tmp/postgres_mydb_*.dump

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL