Databases · about 3 min · 4 steps
Nightly PostgreSQL backups
Backs up every PostgreSQL database and its logins each night, keeping a set number of days.
Runs on
- Debian / Ubuntu: supported
- RHEL / Fedora: supported
- Alpine: supported
Before you start
- Run the PostgreSQL workflow first.
What it changes on your server
- Installs /usr/local/sbin/shellbay-postgres-backup and runs it every night (a systemd timer, or /etc/periodic/daily on Alpine).
- Each night it saves every database to /var/backups/shellbay/postgres/nightly (root only) and deletes backups older than the number of days you choose.
- Records the number of days in /etc/shellbay/postgres-backup.conf.
- Turning the schedule off removes it and keeps the existing backup files.
What Shellbay asks you
Nightly backups
Backups run around 2 a.m. server time. Each night's files are kept for the number of days you choose, then deleted to save disk space. Turn the switch off to stop the schedule.
- Back up every night
- On or off. Default: on
- Days to keep
- A whole number from 1 to 90. Default:
7
Example:
7
Steps
- Check the database server
- Save the settings
- Set up the schedule
- Take the first backup and check it
Shellbay checks the server before the first step, and stops at the first step that fails.
When it's done
- Nightly backups are saved in /var/backups/shellbay/postgres/nightly and kept for ‹days to keep› days. The log is /var/log/shellbay-postgres-backup.log.
- Copy them off the server regularly (for example with the restic workflow): backups on the same disk don't survive losing the server.