forked from rodber/chevereto-free
-
-
Notifications
You must be signed in to change notification settings - Fork 23
/
sync.sh
37 lines (37 loc) · 960 Bytes
/
sync.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
#!/usr/bin/env bash
set -e
SOURCE=/var/www/chevereto-free/
TARGET=/var/www/html/
EXCLUDE="\.git|\.DS_Store|\/docs"
cp "${SOURCE}".gitignore "${TARGET}".gitignore
function sync() {
cp "${SOURCE}"sync.sh /var/www/sync.sh
rsync -r -I -og \
--chown=www-data:www-data \
--info=progress2 \
--exclude '.git' \
--include 'content/images/system/default/*' \
--include 'content/pages/default/*' \
--exclude 'sync.sh' \
--exclude 'content/images/system/*' \
--exclude 'content/images/users/*' \
--exclude 'content/pages/*' \
--filter=':- .gitignore' \
--filter=':- .dockerignore' \
--delete \
$SOURCE $TARGET
}
sync
inotifywait \
--event create \
--event delete \
--event modify \
--event move \
--format "%e %w%f" \
--exclude $EXCLUDE \
--monitor \
--recursive \
$SOURCE |
while read CHANGED; do
sync
done