2

Im pretty sure someone knows the answer, i'm trying to find a way to execute wp cli commands to all sites on my server.

So my directory structure is /srv/users/serververpilot/apps/*/public

The asterisk is where all the sites are located in, each site has a different public directory.

So I know I can run something like:

wp core update --path='/srv/users/serverpilot/apps/myfirstsite/public/'
wp core update --path='/srv/users/serverpilot/apps/mysecondsite/public/'
wp core update --path='/srv/users/serverpilot/apps/mythirdsite/public/'

However what i'm looking for is how can I mass run Wordpress updates via wp cli to all sites under /srv/users/serververpilot/apps/*/public

Anyone has any pointers?

2

Here's an example using find with a directory type and zero maxdepth:

$ find /srv/users/serverpilot/apps/*/public/ \
-type d \
-maxdepth 0 \
-exec /usr/local/bin/wp core update --path={} \;

or in a single line:

$ find /srv/users/serverpilot/apps/*/public/ -type d -maxdepth 0 -exec /usr/local/bin/wp core update --path={} \;

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.