Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Paste
P1269
quick and dirty postgresql backup script based on zfs snapshot
Active
Public
Actions
Authored by
vsellier
on Jan 27 2022, 10:25 AM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
None
Subscribers
None
root@dali:~#
cat
backup.sh
#!/bin/bash
i
=
0
dataset
=
data/postgresql
wal
=
data/postgresql/wal
while
true
;
do
id
=
$(
printf
"%03d%s\n"
$i
)
echo
Switch
pg
in
backup
mode
sudo
-i
-u
postgres
psql
-c
"select pg_start_backup('
$id
')"
echo
Creating
postgresql
snapshot
zfs
snapshot
${
dataset
}
@
$id
echo
Removing
backup
mode
sudo
-i
-u
postgres
psql
-c
"select pg_stop_backup()"
echo
Creating
wal
snapshot
zfs
snapshot
${
wal
}
@
$id
echo
Sleep
i
=
$((
$i
+
1
))
sleep
15
done
Event Timeline
vsellier
created this paste.
Jan 27 2022, 10:25 AM
2022-01-27 10:25:49 (UTC+1)
Comment Actions
related to
T3889
vsellier
mentioned this in
T3889: Admin database backup
.
Jan 27 2022, 10:50 AM
2022-01-27 10:50:04 (UTC+1)
Log In to Comment