Rsync plugin to many local wordpress installs via script or cli

Posted by Nick Abbey on Server Fault See other posts from Server Fault or by Nick Abbey
Published on 2014-06-06T15:20:45Z Indexed on 2014/06/06 15:28 UTC
Read the original article Hit count: 255

Filed under:
|
|
|
|

I am maintaining a large number of wordpress installs on a production server, and we are looking to deploy InfiniteWP for managing these installs. I am looking for a way to script the distribution of the plugin folder to all of these installs.

On server wp-prod, all sites are stored in /srv//site/ The plugin needs to be copied from ~/iws-plugin to /srv//site/wp-content/plugins/

Here's some pseudo code to explain what I need to do:

array dirs = <all folders in /srv>
for each d in dirs
   if exits "/srv/d/site/wp-content/plugins"
     rsync -avzh --log-file=~/d.log ~/plugin_base_folder /srv/d/site/wp-content/plugins/
   else
     touch d.log
     echo 'plugin folder for "d" not found' >> ~/d.log
   end
end

I just don't know how to make it happen from the cli or via bash. I can (and will) tinker with a bash or ruby script on my test server, but I'm thinking the command-line-fu here on SF is strong enough to handle this issue much more quickly than I can hack together a solution.

Thanks!

© Server Fault or respective owner

Related posts about bash

Related posts about command-line