# Hourly backup, only if something has changed

**URL:** <https://meta.discourse.org/t/hourly-backup-only-if-something-has-changed/27274>\
**Category:** Feature\
**Tags:** backups\
**Created:** [6 april 2015 om 21:57 UTC](https://meta.discourse.org/t/hourly-backup-only-if-something-has-changed/27274 "2015-04-06T21:57:56Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![elberet](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/elberet/32/122404_2.png) [@elberet](https://meta.discourse.org/u/elberet)\
**Post date:** [7 april 2015 om 09:38 UTC](https://meta.discourse.org/t/hourly-backup-only-if-something-has-changed/27274/6 "2015-04-07T09:38:17Z")

</div>

I don’t get why #3 exists in this example. If #1 replicates to #2 (PostgreSQL and files), wouldn’t it be easier to just copy the docker image to #2 and let #2’s PostgreSQL become the replication master when #1 fails?

@frederic: Configure PostgreSQL to store WAL files and provide disk space and limits to cover 5×N days of activity. Have a cronjob run every few minutes that fetches new WAL files and uploads via rsync. Have another cronjob run every N days that pulls a full database dump and destroys all prior WAL files and dumps (or moves them to offline backup).

You can store the necessary scripts for this in `/var/discourse/shared/standalone` (which gets mounted as `/shared` inside the container) and add lines to `/etc/crontab` in `app.yml`’s custom commands section.

---

_[View the full topic](https://meta.discourse.org/t/hourly-backup-only-if-something-has-changed/27274)._
