Importing to multiple sites with bash script and WP CLI
-
We have a client who makes the same update to dozens of sites. They way I’ve been handling it is to build one page, export to an XML file, then import the XML file using scp, then SSh into each site to run wp import.
I’d like to run a bash script to do this but I can’t seem to get it to work. My code is:
#!/bin/bash for i in "$@" do echo "" echo "Starting: $i" ssh -oStrictHostKeyChecking=accept-new "$i@$i.ssh.wpengine.net" 'wp import ~/sites/$i/import.xml --authors=skip; wp cache flush; exit;' echo "Done with $i" echo "" done
I should be able to run this through terminal by using
./script.sh environment1 environment2 ...
but it does not work. It will display “starting import process” and exit with no confirmation.Is there another way to do this I’m not aware of?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Importing to multiple sites with bash script and WP CLI’ is closed to new replies.