mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-07 13:03:45 +02:00
Join networks by touching a file
Signed-off-by: Erik Hollensbe <git@hollensbe.org>
This commit is contained in:
parent
2388c9f4e4
commit
c30a1f60ea
1 changed files with 17 additions and 12 deletions
|
@ -40,30 +40,35 @@ killzerotier() {
|
||||||
|
|
||||||
trap killzerotier INT TERM
|
trap killzerotier INT TERM
|
||||||
|
|
||||||
|
echo "Configuring networks to join"
|
||||||
|
mkdir -p /var/lib/zerotier-one/networks.d
|
||||||
|
|
||||||
|
echo "joining networks: $@"
|
||||||
|
for i in "$@"
|
||||||
|
do
|
||||||
|
echo "Configuring join for $i"
|
||||||
|
touch "/var/lib/zerotier-one/networks.d/${i}.conf"
|
||||||
|
done
|
||||||
|
|
||||||
echo "starting zerotier"
|
echo "starting zerotier"
|
||||||
nohup /usr/sbin/zerotier-one &
|
nohup /usr/sbin/zerotier-one &
|
||||||
|
|
||||||
while ! grepzt
|
while ! grepzt
|
||||||
do
|
do
|
||||||
echo "zerotier hasn't started, waiting a second"
|
echo "zerotier hasn't started, waiting a second"
|
||||||
|
|
||||||
|
if [ -f nohup.out ]
|
||||||
|
then
|
||||||
tail -n 10 nohup.out
|
tail -n 10 nohup.out
|
||||||
|
fi
|
||||||
|
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "joining networks: $@"
|
echo "Ensuring status for networks: $@"
|
||||||
|
|
||||||
for i in "$@"
|
for i in "$@"
|
||||||
do
|
do
|
||||||
echo "joining $i"
|
|
||||||
|
|
||||||
zerotier-cli join "$i"
|
|
||||||
|
|
||||||
if [ $? -ne 0 ]
|
|
||||||
then
|
|
||||||
echo >&2 "ZeroTier could not be started; did you pass the right arguments to \`docker run\`?"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
while [ "$(zerotier-cli get $i status)" != "OK" ]
|
while [ "$(zerotier-cli get $i status)" != "OK" ]
|
||||||
do
|
do
|
||||||
echo "joining $i failed (are they added in central?); trying again in 1s"
|
echo "joining $i failed (are they added in central?); trying again in 1s"
|
||||||
|
|
Loading…
Add table
Reference in a new issue