Files
hassio-repo/telegraf/entrypoint.sh
2022-06-18 20:27:11 +02:00

17 lines
399 B
Bash
Executable File

#!/bin/bash
set -e
. /settings.sh
if [ "${1:0:1}" = '-' ]; then
set -- telegraf "$@"
fi
if [ $EUID -ne 0 ]; then
exec "$@"
else
# Allow telegraf to send ICMP packets and bind to privliged ports
setcap cap_net_raw,cap_net_bind_service+ep /usr/bin/telegraf || echo "Failed to set additional capabilities on /usr/bin/telegraf"
exec setpriv --reuid telegraf --init-groups "$@"
fi