restore doesnt need decimals
This commit is contained in:
@@ -6,7 +6,7 @@ pg_dump $DATABASE_URL --clean > /mnt/save/$b/pg.dump \
|
||||
echo "backup failed; deleting $b"
|
||||
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
|
||||
echo rm empty backup $b
|
||||
fi
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
for b in $(find /mnt/save -type f | sort | tail -n 1); do
|
||||
if [ -n "$b" ]; then
|
||||
echo restoring $b
|
||||
if du -sh "$b" | grep -Ei "^[ ]*(4|2[0-9])(.0)?[Kk]"; 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
|
||||
break
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user