Last active
January 22, 2016 23:59
-
-
Save vandorjw/7f2664ff172b3c7e6169 to your computer and use it in GitHub Desktop.
This file contains hidden or 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/sh | |
| # -- ******************************************************************************** | |
| # -- Description: Monitoring and sync script for identical remote folders | |
| # -- Version: 0.1 | |
| # -- Notes: Ony the folder on the server on which this script resides incurs | |
| # changes. Therefor, we only sync 1 way. | |
| # -- Requires: incron: sudo apt-cache search incron | |
| # using incrontab -e add the following: | |
| # /path/to/folder IN_CLOSE_WRITE /path/to/this/scrip.sh $@/$# | |
| # -- ******************************************************************************** | |
| KEY=/path/to/key.pem | |
| RUSER=user | |
| RHOST_1=www.example.com | |
| RHOST_2=www.example.net | |
| PATH=/path/to/folder/ | |
| RSYNC=/usr/bin/rsync | |
| SSH=/usr/bin/ssh | |
| # Add additional hosts as required | |
| $RSYNC -az -e "$SSH -i $KEY" $PATH $RUSER@$RHOST_1:$PATH | |
| $RSYNC -az -e "$SSH -i $KEY" $PATH $RUSER@$RHOST_2:$PATH |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment