-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.sh
executable file
·68 lines (61 loc) · 1.87 KB
/
run.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/env bash
# SIGTERM-handler
term_handler() {
exit 0
}
trap term_handler SIGTERM
if [ ! -f /sentinel/axe.conf ]; then
if [ -z "$RPCUSER" -o -z "$RPCPASSWORD" -o -z "$RPCPORT" ]; then
echo "When no /sentinel/axe.conf is present, you must at least set RPCUSER, RPCPORT and RPCPASSWORD environment variables"
exit 1
fi
echo "" > /sentinel/axe.conf
if [ -n "$RPCUSER" ]; then
echo "rpcuser=${RPCUSER}" >> /sentinel/axe.conf
fi
if [ -n "$RPCPASSWORD" ]; then
echo "rpcpassword=${RPCPASSWORD}" >> /sentinel/axe.conf
fi
if [ -n "$RPCPORT" ]; then
echo "rpcport=${RPCPORT}" >> /sentinel/axe.conf
fi
fi
if [ ! -f /sentinel/sentinel.conf ]; then
if [ -z "$RPCHOST" ]; then
echo "When no /sentinel/sentinal.conf is present, you must at least set the RPCHOST environment variable"
exit 1
fi
echo "axe_conf=/sentinel/axe.conf" > /sentinel/sentinel.conf
if [ -n "$RPCHOST" ]; then
echo "rpchost=${RPCHOST}" >> /sentinel/sentinel.conf
fi
if [ -n "$NETWORK" ]; then
echo "network=${NETWORK}" >> /sentinel/sentinel.conf
fi
# If these variables are not present, we let sentinel handle default values (which will use sqlite)
if [ -n "$DB_HOST" ]; then
echo "db_host=${DB_HOST}" >> /sentinel/sentinel.conf
fi
if [ -n "$DB_PORT" ]; then
echo "db_port=${DB_PORT}" >> /sentinel/sentinel.conf
fi
if [ -n "$DB_NAME" ]; then
echo "db_name=${DB_NAME}" >> /sentinel/sentinel.conf
fi
if [ -n "$DB_USER" ]; then
echo "db_user=${DB_USER}" >> /sentinel/sentinel.conf
fi
if [ -n "$DB_PASSWORD" ]; then
echo "db_password=${DB_PASSWORD}" >> /sentinel/sentinel.conf
fi
if [ -n "$DB_CHARSET" ]; then
echo "db_charset=${DB_CHARSET}" >> /sentinel/sentinel.conf
fi
if [ -n "$DB_DRIVER" ]; then
echo "db_driver=${DB_DRIVER}" >> /sentinel/sentinel.conf
fi
fi
while true; do
python ./bin/sentinel.py
sleep 1m
done