Created
March 28, 2017 22:46
-
-
Save beeradmoore/5e3e31c1555a3bf09eb38a0de40a92d0 to your computer and use it in GitHub Desktop.
Uses fswatch to watch director for changes, and on change upload files with rsync.
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 | |
| USER="someuser" | |
| SERVER="example.com" | |
| LOCAL_DIR="/Users/ytn3rd/somedir/" | |
| REMOTE_DIR="/var/www/htdocs" | |
| PEM_LOCATION="~/.ssh/some_key.pem" | |
| code $LOCAL_DIR | |
| fswatch -o $LOCAL_DIR | xargs -n1 -I{} rsync -avzh -e "ssh -i $PEM_LOCATION" --include=".htaccess" --exclude=".*" --exclude=".*/" --exclude="*.orig" --rsync-path="sudo -Hu apache rsync" --progress $LOCAL_DIR $USER@$SERVER:$REMOTE_DIR |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment