mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-01-21 12:08:12 +01:00
28 lines
722 B
Plaintext
28 lines
722 B
Plaintext
#!/usr/bin/with-contenv bash
|
|
|
|
##############
|
|
# CHECK PRIV #
|
|
##############
|
|
|
|
ip link delete dummy0 type dummy >/dev/null \
|
|
| ip link add dummy0 type dummy >/dev/null \
|
|
|| { echo "Privileged mode is disabled, the addon will stop" && s6-svscanctl -t /var/run/s6/services }
|
|
|
|
####################
|
|
# Add local drives #
|
|
####################
|
|
|
|
port="8080"
|
|
host="localhost"
|
|
timeout="30"
|
|
timeout_argument=""
|
|
|
|
if timeout -t 1337 true >/dev/null 2>&1; then
|
|
timeout_argument="-t"
|
|
fi
|
|
|
|
timeout ${timeout_argument} "${timeout}" \
|
|
bash -c \
|
|
"until echo > /dev/tcp/${host}/${port} ; do sleep 0.5; done" \
|
|
>/dev/null 2>&1 && bash -c "scrutiny-collector-metrics run" || echo "port $port is not available, local devices won't be available"
|