Created
July 11, 2019 14:05
-
-
Save aadilprabhakar/43ad3fe64c404bf29199dd4298b0ea3a to your computer and use it in GitHub Desktop.
RSync via SSH (Use case - push files to self-hosted CDN)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#################################### | |
# Rsync media to CDN | |
#################################### | |
rsync -avzhe ssh /livehost/wp-content/uploads/ cdnuser@cdnhost:/cdnhost/wp-content/uploads/ | |
rsync -avzhe ssh /livehost/wp-content/plugins/ cdnuser@cdnhost:/cdnhost/wp-content/plugins/ | |
rsync -avzhe ssh /livehost/wp-content/themes/ cdnuser@cdnhost:/cdnhost/wp-content/themes/ | |
rsync -avzhe ssh /livehost/wp-content/mu-plugins/ cdnuser@cdnhost:/cdnhost/wp-content/mu-plugins/ | |
rsync -avzhe ssh /livehost/wp-includes/ cdnuser@cdnhost:/cdnhost/wp-includes/ | |
#echo "Subject: CDN sync" | sendmail -v in.case@you.want.tobe.notified | |
#create log with datetime as filename | |
alias logname="date +%s" | |
touch /livehost/.synclogs/log.$(logname) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You do need to create and authorize your ssh key before trying to connect :)