Advertisement
Guest User

Untitled

a guest
Oct 18th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. USER="remote_user_here"
  4. SERVER="remote_server_here"
  5. LOCAL_DIR="/local/dir/here/"
  6. REMOTE_DIR="/remote/dir/here/"
  7. PEM_LOCATION="/path/to/local/key.pem"
  8.  
  9. # Open VSCode with your files.
  10. code $LOCAL_DIR
  11.  
  12. # Start fswatch, wait for changes in your local dir and then execute rsync.
  13. # NOTE: Syncs remotely as apache user.
  14. fswatch -o $LOCAL_DIR | xargs -n1 -I{} rsync -avzh -e "ssh -i $PEM_LOCATION" \
  15. --include=".htaccess" \
  16. --exclude=".*" \
  17. --exclude=".*/" \
  18. --exclude="*.orig" \
  19. --rsync-path="sudo -Hu apache rsync" $LOCAL_DIR $USER@$SERVER:$REMOTE_DIR
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement