0

I am trying to export a remote wp db using the following:

source_gzip_db=git-dumps/export.sql.gz
source_path_to_wordpress=/home/username/public_html
source_ssh_host="123.456.789.12"
source_ssh_user="username"
connecting_keyfile="/home/username/.ssh/id_rsa"



ssh -p22 -i $connecting_keyfile $source_ssh_user@$source_ssh_host  'cd public_html && bash' << EOF

    php wp-cli.phar db export --exclude_tables=wp_,wp_, --path=$source_path_to_wordpress - | gzip > $source_path_to_wordpress$source_gzip_db

EOF


where $source_path_to_wordpress is /home/username/public_html

But I keep getting the following error:

Error: This does not seem to be a WordPress installation.
Pass --path=`path/to/wordpress` or run `wp core download`.

Any tips?

2
  • Can you make it work hard-coding the $source_path_to_wordpress in the >>> section? I'm not sure how expansion works with >>> sections. Does the variable exist on this system or the system you're SSHing into?
    – Rup
    Sep 19 at 7:55
  • @Rup thx for your feedback...I added the variable valuables above... but your comment gave me a pretty good idea of whats wrong. I run this script on a different server where the username of remote and local are the same (therefore all paths are the same). However, for the above the usernames are different between remote and local (different paths) so the script can't find the variables. I believe my solution is to create a remote script with variables and paths & use my ssh command above to execute that script remotely. that should get me my exported db.... will post answer, if successful
    – mjones
    Sep 19 at 9:21

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.