From 1b2e95532b6dfeb46adbd2fbf5e0a1ef83854c86 Mon Sep 17 00:00:00 2001 From: Jason Kulatunga Date: Thu, 8 Oct 2020 21:24:35 -0600 Subject: [PATCH] automatically run collector on container startup. fixes #73 --- rootfs/etc/services.d/collector-once/run | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 rootfs/etc/services.d/collector-once/run diff --git a/rootfs/etc/services.d/collector-once/run b/rootfs/etc/services.d/collector-once/run new file mode 100644 index 0000000..46369a1 --- /dev/null +++ b/rootfs/etc/services.d/collector-once/run @@ -0,0 +1,14 @@ +#!/usr/bin/with-contenv bash + +echo "waiting for scrutiny service to start" +s6-svwait -u /var/run/s6/services/scrutiny + +#tell s6 to only run this script once +s6-svc -O /var/run/s6/services/collector-once + +# wait until scrutiny is "Ready" +while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://localhost:8080/api/health)" != "200" ]]; do sleep 5; done + + +echo "starting scrutiny collector" +/scrutiny/bin/scrutiny-collector-metrics run