container-images/rsyncd/run.sh
dresi 46e0a70521
Some checks failed
Build and push rsyncd image / build-and-push-image (push) Failing after 6m3s
Build and push telegraf-snmp image / build-and-push-image (push) Failing after 6m4s
feat: initial structure with rsyncd and telegraf-snmp images
2026-06-10 10:29:16 +02:00

30 lines
713 B
Bash

#!/bin/bash
VOLUME=${VOLUME:-"volume"}
ALLOW=${ALLOW:-192.168.0.0/16 172.16.0.0/12}
OWNER=${OWNER:-nobody}
GROUP=${GROUP:-nogroup}
# create users matching ids passed if necessary
if [ "${GROUP}" != "nogroup" ]; then
groupadd -g ${GROUP} rsyncdgroup
fi
if [ "${OWNER}" != "nobody" ]; then
groupadd -u ${OWNER} -G rsyncdgroup rsyncduser
fi
[ -f /etc/rsyncd.conf ] || cat <<EOF > /etc/rsyncd.conf
uid = ${OWNER}
gid = ${GROUP}
use chroot = yes
pid file = /var/run/rsyncd.pid
log file = /dev/stdout
[${VOLUME}]
hosts deny = *
hosts allow = ${ALLOW}
read only = false
path = /volume
comment = ${VOLUME}
EOF
exec /usr/bin/rsync --no-detach --daemon --config /etc/rsyncd.conf "$@"