-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathensure-all-running
executable file
·72 lines (61 loc) · 1.72 KB
/
ensure-all-running
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
69
70
71
72
#!/bin/bash
#/ Usage ./ensure-all-running
#/ checks that all of tiny's docker services are running.
main() {
cd "$(dirname "$0")"
STATUS=$(docker ps -a --format '{{.Names}} {{.Status}}')
check gnucash-reports \
../gnucash_reports script/docker-server --pull
check pihole \
../my-docker-pi-hole docker-compose up -d
check amplifi-exporter \
prometheus ./start-amplifi-exporter
check apt-cacher-ng \
apt-cacher-ng ./start
check cadvisor \
prometheus ./start-cadvisor
check homeassistant \
home-assistant ./run
check influxdb \
influxdb ./start
check nethack \
nethack ./start
check node-exporter \
prometheus ./start-node-exporter
check ptp \
ptp ./start
check starlink-exporter \
starlink ./start
check upornot \
up-or-not ./start
check zerotier \
zerotier ./start
# needs influxdb
check mytagdata \
mytagdata ./start
# needs node-exporter, cadvisor, amplifi-exporter, starlink-exporter
check prometheus \
prometheus ./start-prometheus
# needs prometheus
check grafana \
prometheus ./start-grafana
# needs apt-cacher-ng, gnucash-reports, grafana, pihole, ptp, upornot
check defaultwebserver \
nginx ./start
}
# Usage: check CONTAINER DIR START_COMMAND...
check() {
local container="$1"; shift
local dir="$1"; shift
local status_line="$(echo "$STATUS" | grep "^$container")"
echo "** $status_line"
if [ "$(echo "$status_line" | awk '{print $2}')" != "Up" ]; then
docker logs --tail 3 "$container" 2>/dev/null
echo "--------"
echo starting $container...
(cd "$dir" && "$@")
else
(cd "$dir" 2>/dev/null && test -e "$1") || echo " warning: would not be able to start '$container' in '$dir' with '$@'"
fi
}
main