Last active
March 5, 2022 06:23
-
-
Save mrdomino/bfbbab56602d215ffafdc13b8696b27a to your computer and use it in GitHub Desktop.
rsync source with destination every time any change occurs in source
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/sh | |
set -eu | |
trap "echo 'usage: $0 <pier> <base> [desk]' >&2" EXIT | |
pier=$1 | |
base=$2 | |
if [ 3 -eq $# ]; then | |
desk=$3 | |
else | |
desk=base | |
fi | |
trap - EXIT | |
set -x | |
rsync -avL --delete $base/ $pier/$desk/ | |
fswatch -o $base | xargs -n1 -I{} sh -c "rsync -avL --delete $base/ $pier/$desk/; date" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment