2 Commits
v0.9 ... v1.0.1

Author SHA1 Message Date
Bel LaPointe
604b803f74 hopefully fix restore again 2020-05-29 08:02:26 -06:00
Bel LaPointe
ab0944cbff restore doesnt need decimals 2020-05-29 07:32:26 -06:00
2 changed files with 13 additions and 5 deletions

View File

@@ -6,7 +6,7 @@ pg_dump $DATABASE_URL --clean > /mnt/save/$b/pg.dump \
echo "backup failed; deleting $b" echo "backup failed; deleting $b"
exit 1 exit 1
) )
if du -sh /mnt/save/$b | grep -Ei "^[ ]*(4|20).0K"; then if du -sh /mnt/save/$b | grep -Ei "^[ ]*(4|2.).0K"; then
rm -rf /mnt/save/$b rm -rf /mnt/save/$b
echo rm empty backup $b echo rm empty backup $b
fi fi

View File

@@ -1,6 +1,14 @@
for b in $(find /mnt/save -type f | sort | tail -n 1); do for b in $(find /mnt/save -not -path '*/\.*' -type f | sort -r); do
if [ -n "$b" ]; then if [ -n "$b" ]; then
echo restoring $b du -sh "$b"
if ! du -sh "$b" | grep -Ei "^[ \t]*[0-9][0-9]?(.0)?[mg]"; then
echo would rm empty backup $b >&2
set -x
mv "$b" "${b%/*}/.${b##*/}"
set +x
continue
fi
echo restoring $b >&2
if psql $DATABASE_URL < "$b"; then if psql $DATABASE_URL < "$b"; then
break break
fi fi