forked from dperson/smokeping
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlaunch.sh
More file actions
executable file
·44 lines (34 loc) · 1.49 KB
/
launch.sh
File metadata and controls
executable file
·44 lines (34 loc) · 1.49 KB
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
#!/bin/bash
#set -eo pipefail
export ETCD_PORT=${ETCD_PORT:-4001}
export HOST_IP=${HOST_IP:-172.17.42.1}
export ETCD=$HOST_IP:$ETCD_PORT
echo "[smokeping] booting container. ETCD: $ETCD."
# General Initial Config
until confd -onetime -node $ETCD -config-file /etc/confd/conf.d/sp-general.toml; do
echo "[smokeping] waiting for confd to create initial smokeping configuration."
sleep 5
done
# Alerts Initial Config
until confd -onetime -node $ETCD -config-file /etc/confd/conf.d/sp-alerts.toml; do
echo "[smokeping] waiting for confd to create initial smokeping configuration."
sleep 5
done
# Targets Initial Config
until confd -onetime -node $ETCD -config-file /etc/confd/conf.d/sp-targets.toml; do
echo "[smokeping] waiting for confd to create initial smokeping configuration."
sleep 5
done
cat /etc/smokeping/config.d/Targets
# Put a continual polling `confd` process into the background to watch
# for changes every 10 seconds
confd -interval 10 -node $ETCD -config-file /etc/confd/conf.d/sp-general.toml &
confd -interval 10 -node $ETCD -config-file /etc/confd/conf.d/sp-alerts.toml &
confd -interval 10 -node $ETCD -config-file /etc/confd/conf.d/sp-targets.toml &
echo "[smokeping] confd is now monitoring etcd for changes..."
# Start the smokeping service using the generated config
echo "[smokeping] starting smokeping service..."
service smokeping start
# Follow the logs to allow the script to continue running
tail -f /var/log/*.log &
exec lighttpd -D -f /etc/lighttpd/lighttpd.conf