Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

restore latest file failed #340

Open
Overbuiltx opened this issue Apr 18, 2024 · 0 comments
Open

restore latest file failed #340

Overbuiltx opened this issue Apr 18, 2024 · 0 comments
Labels

Comments

@Overbuiltx
Copy link

Summary

When you try to restore a /backup/latest* file in non-interactive mode, you get all sorts of errors like this:

invalid command \!7{Oj?VB֓V9kIh[                                                                          
invalid command \L;Mmٰa<i                                                                                 
invalid command \Rkn                                                                                                                                                                                               
invalid command \Z,fJDsؘFF6Zp8W                                                                                                                                                                                     
                              J3=:Ez87(0q{]$ 

This is because the file extension can't be read by decompress_cmd function which leads to

pv ${r_filename} | cat | psql -d ${r_dbname} -h ${r_dbhost} -p ${r_dbport} -U ${r_dbuser}

instead of

pv ${r_filename} | ${decompress_cmd}cat | psql -d ${r_dbname} -h ${r_dbhost} -p ${r_dbport} -U ${r_dbuser}

and restoring a compressed file just fails.

Steps to reproduce

restore /backup/latest-pgsql_gitea_db pgsql db x x x 5432

What is the expected correct behavior?

Restore correctly.

Environment

tiredofit/db-backup:4.0.35

Possible fixes

One workaround is

restore $(readlink -f /backup/latest-pgsql_gitea_db) pgsql db x x x 5432

In general it would be nice to extend the decompress function, like:

if file is symlink; file=$(readlink $file); done

Also, a cross check would be great, if decompress_cmd has a valid value.

Thanks for your work :)

@Overbuiltx Overbuiltx added the bug label Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant