3 ms·
I do this kind of thing using a one-liner: while true; do inotifywait -r --exclude '^\..*\.swp$' -e CLOSE_WRITE src_dir; sleep 1; rsync -a src_dir/ dst_host:ds
by rlpb 17y ago
I do this kind of thing using a one-liner:
while true; do inotifywait -r --exclude '^\..*\.swp$' -e CLOSE_WRITE src_dir; sleep 1; rsync -a src_dir/ dst_host:dst_dir/;done
This version has a race condition, but is sufficient for pushing a source tree into a testing environment automatically during development. You could also use the -m switch to inotifywait and a while loop on the output to avoid the race.
I wouldn't want to use anything apart from manual deployment script to deploy to CDNs since a daemon adds another point of failure. To check for a failure you'd need to check that the daemon has done its job, at which point you'd be running a script to do this and so could just use rsync at that point instead.