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.  

            #!/bin/bash
# execute script in terminal by running bash scriptname.sh 

# 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 user@cpanel-production-1.acns.colostate.edu

# test that it worked (to not be prompted with password)
# ssh user@cpanel-production-1.acns.colostate.edu

# path variables
local_Path="/Applications/MAMP/htdocs/wp-content/commercial-plugins"
hds_wpPath="user@cpanel-production-1.acns.colostate.edu:/home/cwis308/public_html/wp-content/plugins"

hdswp_bckPath="bck/hds"

pgPack="bdthemes-element-pack"

# 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 user@cpanel-production-1.acns.colostate.edu:/home/user/public_html/wp-content/plugins/bdthemes-element-pack/ /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