bicep/{postgres,mysql}: use hardlink for latest backup file

This commit is contained in:
h7x4
2026-01-29 14:53:07 +09:00
parent 1d46fd1ec6
commit bcf8b1607f
2 changed files with 4 additions and 2 deletions

View File

@@ -53,8 +53,9 @@ in
pg_dumpall -U postgres | zstd --compress -9 --rsyncable -o "$OUT_FILE"
# NOTE: this needs to be a hardlink for rrsync to allow sending it
rm "$STATE_DIRECTORY/postgresql-dump-latest.sql.zst" ||:
ln -s -T "$OUT_FILE" "$STATE_DIRECTORY/postgresql-dump-latest.sql.zst"
ln -T "$OUT_FILE" "$STATE_DIRECTORY/postgresql-dump-latest.sql.zst"
while [ $(find -type f "$STATE_DIRECTORY" -printf '.' | wc -c) -gt ${toString rotations} ]; do
rm $(find "$STATE_DIRECTORY" -type f -printf '%T+ %p\n' | sort | head -n 1 | cut -d' ' -f2)