mirror of https://github.com/hashicorp/consul
26 lines
502 B
Plaintext
26 lines
502 B
Plaintext
|
description "Join the consul cluster"
|
||
|
|
||
|
start on started consul
|
||
|
stop on stopped consul
|
||
|
|
||
|
task
|
||
|
|
||
|
script
|
||
|
if [ -f "/etc/service/consul-join" ]; then
|
||
|
. /etc/service/consul-join
|
||
|
fi
|
||
|
|
||
|
# Keep trying to join until it succeeds
|
||
|
set +e
|
||
|
while :; do
|
||
|
logger -t "consul-join" "Attempting join: ${CONSUL_JOIN}"
|
||
|
/usr/local/bin/consul join \
|
||
|
${CONSUL_JOIN} \
|
||
|
>>/var/log/consul-join.log 2>&1
|
||
|
[ $? -eq 0 ] && break
|
||
|
sleep 5
|
||
|
done
|
||
|
|
||
|
logger -t "consul-join" "Join success!"
|
||
|
end script
|