-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsyncing.sh
executable file
·44 lines (36 loc) · 881 Bytes
/
syncing.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#! /usr/bin/env bash
if [ "$1" == "--help" ]; then
echo """
Usage:
./scripts/syncing.sh username@server:/path/to/repo
The argument must be a valid scp destination.
"""
exit 0
fi
TARGET="$1"
echo "$TARGET"
while true; do
rsync -azv \
--copy-links \
--delete \
--exclude '*.egg-info' \
--exclude '.tox*' \
--exclude '/site/' \
--exclude '**pycache**' \
--exclude '/.mypy_cache/' \
--exclude '/.pytest_cache/' \
--exclude '.covera*' \
--exclude '.coverage*' \
--exclude 'htmlcov' \
--exclude 'notebooks' \
. "$TARGET"
date
sleep 0.5
if [[ "$(uname)" = "Darwin" ]]; then
# For Mac OS X
fswatch --latency 0.5 --one-event --follow-links "`pwd`"
else
# hope it is Linux / no support for windows
inotifywait -r -e modify,create,delete "`pwd`"
fi
done