Created
September 23, 2020 09:59
-
-
Save dhsathiya/240ce8fcccd975dec55d90d590b0295b 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
# bash update_and_sync.sh /tmp/test/ [email protected] /tmp/test/ | |
# syntax bash update_and_sync.sh <source> <user@ip> <destination> | |
DIRECTORY_TO_WATCH="$1" | |
REMOTE_SERVER_USER_IP="$2" | |
REMOTE_SERVER_LOCATION="$3" | |
inotifywait -m $DIRECTORY_TO_WATCH -e close_write -e delete | | |
while read path action file; do | |
rsync -avzhP $path $REMOTE_SERVER_USER_IP:$REMOTE_SERVER_LOCATION --delete | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For local
Local with changing file permissions to www-data