tailscale-docker/image/start.sh

21 lines
621 B
Bash
Raw Normal View History

#!/bin/ash
trap 'kill -TERM $PID' TERM INT
echo "Starting Tailscale daemon"
2023-12-29 18:05:47 +00:00
tailscaled --tun=userspace-networking --statedir="${TS_STATEDIR}" ${TS_OPT} &
PID=$!
2023-12-29 04:20:00 +00:00
until tailscale up --authkey="${TS_AUTHKEY}" --hostname="${TS_HOSTNAME}"; do
2023-12-28 19:25:49 +00:00
sleep 0.1
done
tailscale status
if [ -n "${TS_SERVE_PORT}" ]; then
if ! tailscale serve status | grep -q "${TS_SERVE_PORT}"; then
tailscale serve --bg "${TS_SERVE_PORT}"
fi
fi
2023-12-29 15:48:11 +00:00
if [ -n "${TS_FUNNEL_PORT}" ]; then
if ! tailscale funnel status | grep -q -A1 '(Funnel on)' | grep -q "${TS_FUNNEL_PORT}"; then
tailscale funnel --bg "${TS_FUNNEL_PORT}"
fi
fi
wait ${PID}