Using rSync To Quickly Upgrade WordPress Plugins

We occasionally have commercial WordPress plugins that don’t auto-update.  In those instances, it’s still easy to upgrade them all at once, across both our multi-site networks/sites using the following bash script.  

# execute script in terminal by running bash 

# to generate public/private key pair (to avoid repeated logins)
# ssh-keygen -t rsa

# to copy the generated public key to remote server
# ssh-copy-id

# test that it worked (to not be prompted with password)
# ssh

# path variables



# set proper file permissions before the transfer, if necessary
#find . -type d -exec chmod 755 {} \;  # Change directory permissions rwxr-xr-x
#find . -type f -exec chmod 644 {} \;  # Change file permissions rw-r--r--

# HDSWP -  make a backup of commercial plugin and then copy local plugin to remote: Element Pack
# rsync -avz /Applications/MAMP/htdocs/wp-content/commercial-plugins/bck/hds/bdthemes-element-pack
rsync -avz $hds_wpPath/$pgPack/ $local_Path/$hdswp_bckPath/$pgPack/;rsync -avz $local_Path/$pgPack/ $hds_wpPath/$pgPack