forked from rhyolight/omg-monitor
-
Notifications
You must be signed in to change notification settings - Fork 1
/
startup.sh
executable file
·42 lines (36 loc) · 922 Bytes
/
startup.sh
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
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
# Create logs dir
mkdir -p $LOG_DIR
# Initialize access token to empty string
SERVER_TOKEN=
# Parse access token to SERVER_TOKEN variable
OPTIND=1
while getopts ":t:" opt; do
case $opt in
t)
SERVER_TOKEN=$OPTARG
echo "-t was triggered, Parameter: $SERVER_TOKEN" >&2
;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit 1
;;
:)
echo "Option -$OPTARG requires an argument." >&2
exit 1
;;
esac
done
# Shift parameters to get config files
shift $(expr $OPTIND - 1 )
# Put monitor args on env variable to be accessed by supervisor
export MONITOR_ARGS=$*
export SERVER_TOKEN=$SERVER_TOKEN
# Start monitors running NuPIC
if [ -z "$DYNAMIC" ]; then
# If not dynamic
exec supervisord -c /home/docker/omg-monitor/config/supervisor.conf
else
# If dynamic
exec supervisord -c /home/docker/omg-monitor/config/supervisor_dynamic.conf
fi