restore doesnt need decimals
parent
cf008cd284
commit
ab0944cbff
|
|
@ -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
|
||||
|
|
|
|||
13
restore.sh
13
restore.sh
|
|
@ -1,9 +1,16 @@
|
|||
for b in $(find /mnt/save -type f | sort | tail -n 1); do
|
||||
if [ -n "$b" ]; then
|
||||
echo restoring $b
|
||||
if [ -n "$b" ]; then
|
||||
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
|
||||
fi
|
||||
fi
|
||||
done
|
||||
service postgresql start
|
||||
|
|
|
|||
Loading…
Reference in New Issue