aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/qrs
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/qrs')
-rwxr-xr-xscripts/qrs80
1 files changed, 80 insertions, 0 deletions
diff --git a/scripts/qrs b/scripts/qrs
new file mode 100755
index 0000000..be41aa0
--- /dev/null
+++ b/scripts/qrs
@@ -0,0 +1,80 @@
+#!/bin/bash
+
+# standard rsync port is 873, I choose 8873 for userside listen.
+PORT=8873
+
+printf "Examples of get with rsync (full rsync):\n"
+
+msg=" rsync -Pa 'rsync://%s:${PORT}/qrs/.' .\n"
+printf "$msg" "${HOSTNAME}.local"
+printf "$msg" "${HOSTNAME}"
+
+for ipv6 in ::1 \
+ $(ip -oneline -family inet6 address show scope site \
+ | sed 's/^.*inet6 \([0-9:a-fA-F]\+\).*$/\1/') \
+ $(ip -oneline -family inet6 address show scope global \
+ | sed 's/^.*inet6 \([0-9:a-fA-F]\+\).*$/\1/') \
+; do
+ printf "$msg" "[${ipv6}]"
+done
+
+for ipv4 in $(ip -oneline -family inet address show \
+ | sed 's/^.*inet \([0-9.]\+\).*$/\1/'); do
+ printf "$msg" "${ipv4}"
+done
+
+# <(cat <<EOF ... EOF) redirection does not work with rsync, I suspect the
+# daemon to read two times the file. Make a real file instead and delete it
+# with a trap.
+
+CONF=$(mktemp)
+cleanup() { rm -f "$CONF"; }
+trap cleanup EXIT INT QUIT HUP TERM ABRT
+
+cat >"$CONF" <<EOF
+# GLOBAL OPTIONS
+#motd file=/etc/motd
+#log file=/var/log/rsyncd
+# for pid file, do not use /var/run/rsync.pid if
+# you are going to run rsync out of the init.d script.
+# The init.d script does its own pid file handling,
+# so omit the "pid file" line completely in that case.
+# pid file=/var/run/rsyncd.pid
+#syslog facility=daemon
+#socket options=
+port = $PORT
+reverse lookup = no
+
+# MODULE OPTIONS
+[qrs]
+path = $PWD
+use chroot = no
+
+#comment = public archive
+#use chroot = no
+#max connections=10
+#lock file = /var/lock/rsyncd
+# the default for read only is yes...
+#read only = yes
+#list = yes
+#uid = nobody
+#gid = nogroup
+#exclude =
+#exclude from =
+#include =
+#include from =
+#auth users =
+#secrets file = /etc/rsyncd.secrets
+#strict modes = yes
+#hosts allow =
+#hosts deny =
+#ignore errors = no
+#ignore nonreadable = yes
+#transfer logging = no
+#log format = %t: host %h (%a) %o %f (%l bytes). Total %b bytes.
+#timeout = 600
+#refuse options = checksum dry-run
+#dont compress = *.gz *.tgz *.zip *.z *.rpm *.deb *.iso *.bz2 *.tbz
+EOF
+
+rsync --daemon --no-detach --log-file=/dev/stderr --config="$CONF"