blob: 9a57990ae1d6a740b45e0a006b50e2ad9fd5ce24 (
plain) (
blame)
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
|
#!/bin/bash
function graceful_exit(){
# Note, "service naemon stop" does not work in the phusion image
# We just kill the process rather than chase this down.
pkill naemon
exit $1
}
# Recup fichiers Ismael
if [ -n "$NAMESPACE" ]; then
echo "Namespace: $NAMESPACE"
else
echo "Le namespace n'a pas été défini dans \$NAMESPACE."
exit 1
fi
curl -o /etc/naemon/conf.d/objects.cfg "https://status.immae.eu/$NAMESPACE/objects.conf"
curl -o /etc/naemon/module-conf.d/immae.cfg "https://status.immae.eu/common/immae.cfg"
curl -o /etc/naemon/resource.cfg "https://status.immae.eu/common/resource.cfg"
curl "https://status.immae.eu/$NAMESPACE/plugins.tar" | tar -C /etc/naemon -x
sed -i -e "s|@@COMMON_PLUGINS@@|/usr/lib/naemon/plugins|" \
-e "s|@@IMMAE_PLUGINS@@|/etc/naemon/immae_plugins/|" \
-e "s|@@TOKEN@@|$NOTIFY_REMOTE_TOKEN|" \
/etc/naemon/resource.cfg
# Ensure consistent ownership for the data volume, even if the
# UID/GID's changes
chown -R naemon:naemon /etc/naemon /data/var/log/naemon
# Start the services
service naemon start
# Trap exit signals and do a proper shutdown
trap "graceful_exit 0;" SIGINT SIGTERM
sleep 5
while true
do
if ! [ -d "/proc/$(cat /var/run/naemon/naemon.pid)" ]; then
echo "Naemon no longer running"
graceful_exit 1
fi
sleep 1
done
|