File: koanfconsul.sh

package info (click to toggle)
golang-github-knadh-koanf 2.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 808 kB
  • sloc: sh: 31; makefile: 14
file content (27 lines) | stat: -rwxr-xr-x 364 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
consul agent -dev &

exitcode=1
iterations=0

while [ $exitcode -ne 0 ]
do
	consul members
	exitcode=$?

	sleep 1
	((iterations++))

	if [ $iterations -gt 5 ]; then
		break
	fi
done

if [ $exitcode -eq 0 ]; then
	echo -e "\nTest program running..."
	go run main.go
	echo -e "\nShutdown..."
	consul leave
else
	echo "Consul server is inavailable."
	consul leave
fi