Skip to content

Commit

Permalink
add files
Browse files Browse the repository at this point in the history
  • Loading branch information
akerl committed Dec 6, 2024
1 parent 6915422 commit caf53af
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
9 changes: 9 additions & 0 deletions files/maybe-backup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash

set -euo pipefail

backupdir="$1"
file="dump_$(date "+%Y%m%d-%H%M%S").sql"

docker exec -t postgres pg_dumpall -c -U maybe_user > "$backupdir/$file"

9 changes: 9 additions & 0 deletions files/maybe-backup.timer
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Unit]
Description=Schedule backups for maybe postgres

[Timer]
OnBootSec=600
OnUnitActiveSec=36000

[Install]
WantedBy=multi-user.target
9 changes: 9 additions & 0 deletions templates/maybe-backup.service.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Unit]
Description=Run backup for maybe postgres

[Service]
Type=simple
ExecStart=/usr/local/bin/maybe-backup.sh <%= @datadir + '/backup' %>
<% if @postgres_watchdog -%>
ExecStartPost=/usr/bin/curl <%= @postgres_watchdog %>
<% end -%>

0 comments on commit caf53af

Please sign in to comment.