for b in $(find /mnt/save -type f | sort | tail -n 1); do if [ -n "$b" ]; then echo restoring $b if psql $DATABASE_URL < "$b"; then break fi fi done service postgresql start