-
Notifications
You must be signed in to change notification settings - Fork 1
/
server
executable file
·54 lines (45 loc) · 1.24 KB
/
server
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
45
46
47
48
49
50
51
52
53
54
#!/bin/sh
echo "$RSYNC_USERNAME:$RSYNC_PASSWORD" > /etc/rsyncd.secrets
chmod 0400 /etc/rsyncd.secrets
chmod 666 `readlink --canonicalize /dev/stderr /dev/stdout`
if [ -f /etc/rsyncd.conf ]; then
echo "Using existing rsync conf";
else
cat << __EOF__ > /etc/rsyncd.conf
# GLOBAL OPTIONS
port = $RSYNC_PORT
#motd file=/etc/motd
pid file = /var/run/rsyncd.pid
log file = /dev/stdout
timeout = $RSYNC_TIMEOUT
max connections = $RSYNC_MAX_CONNECTIONS
#syslog facility=daemon
#socket options=
# MODULE OPTIONS
[$RSYNC_NAME]
uid = $RSYNC_UID
gid = $RSYNC_GID
hosts deny = *
hosts allow = ${RSYNC_ALLOW}
read only = $RSYNC_READ_ONLY
path = $RSYNC_VOLUME
comment = $RSYNC_NAME volume on $RSYNC_VOLUME
auth users = $RSYNC_USERNAME
secrets file = /etc/rsyncd.secrets
lock file = /var/lock/rsyncd
list = yes
ignore errors = no
ignore nonreadable = yes
transfer logging = yes
log format = %t: host %h (%a) %o %f (%l bytes). Total %b bytes.
refuse options = checksum dry-run
dont compress = *.gz *.tgz *.zip *.z *.rpm *.deb *.iso *.bz2 *.tbz
exclude = *.!sync *.swp
# exclude from =
# include =
# include from =
# use chroot = yes
# strict modes = yes
__EOF__
fi
exec /usr/bin/rsync --no-detach --daemon --config /etc/rsyncd.conf "$@"