rDrama/scripts/pitr.sh

20 lines
602 B
Bash
Raw Normal View History

2023-09-07 15:25:28 +00:00
change recovery_target_time in /etc/postgresql/15/new/postgresql.conf like this
2023-09-07 12:09:56 +00:00
recovery_target_time = '2023-09-07 3:18:24'
2023-08-14 13:44:02 +00:00
2023-09-07 12:09:56 +00:00
systemctl stop postgresql@15-new
rm -r /var/lib/postgresql/15/new
cp -ar /database_backup/. /var/lib/postgresql/15/new
chmod 700 /var/lib/postgresql/15/new
rm -r /var/lib/postgresql/15/new/pg_wal
cp -ar /var/lib/postgresql/15/main/pg_wal/. /var/lib/postgresql/15/new/pg_wal
touch /var/lib/postgresql/15/new/recovery.signal
systemctl start postgresql@15-new
psql "${DATABASE_URL/5432/"5433"}"
wait after recovery is done then:
2023-09-07 12:09:56 +00:00
rm /var/lib/postgresql/15/new/recovery.signal