-
-
Notifications
You must be signed in to change notification settings - Fork 239
/
Copy pathrun-lb-command
executable file
·30 lines (25 loc) · 989 Bytes
/
run-lb-command
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
28
29
30
#!/bin/bash
# In consul-template's exec mode (https://github.com/hashicorp/consul-template/blob/master/docs/modes.md#exec-mode)
# subprocesses do not run in a shell, so we use this wrapper script to correctly set the working directory
# and then exec to the desired process. We use exec so that signals are passed to the process correctly.
. /etc/lb-startup-common.sh
cd /code/listenbrainz
log run-lb-command starting "$@"
# we grep the config file rendered by consul to check for missing keys
keyerrors=$(grep KEYDOESNOTEXIST listenbrainz/config.py)
if [ -n "$keyerrors" ]; then
log "Found keys that are missing from consul"
echo "$keyerrors"
log "Config file is as follows"
cat listenbrainz/config.py
exit 10
fi
serviceerrors=$(grep SERVICEDOESNOTEXIST listenbrainz/config.py)
if [ -n "$serviceerrors" ]; then
log "Found services that are missing from consul"
echo "$serviceerrors"
log "Config file is as follows"
cat listenbrainz/config.py
exit 11
fi
exec "$@"