From e0f08076bfdc83a73515eaaf7d1adaa889001028 Mon Sep 17 00:00:00 2001
From: ale <ale@incal.net>
Date: Sat, 3 Nov 2018 14:30:13 +0000
Subject: [PATCH] Run daily curator cleanup jobs in the container

---
 Dockerfile                         |  1 +
 conf/chaperone.d/curator-cron.conf |  5 +++++
 curator-cron                       | 12 ++++++++++++
 3 files changed, 18 insertions(+)
 create mode 100644 conf/chaperone.d/curator-cron.conf
 create mode 100755 curator-cron

diff --git a/Dockerfile b/Dockerfile
index 5a6075e..8e6a2f2 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -2,6 +2,7 @@ FROM registry.git.autistici.org/ai3/docker-chaperone-base:master
 
 COPY conf /tmp/conf
 COPY build.sh /tmp/build.sh
+COPY curator-cron /usr/bin/curator-cron
 
 RUN /tmp/build.sh && rm /tmp/build.sh
 
diff --git a/conf/chaperone.d/curator-cron.conf b/conf/chaperone.d/curator-cron.conf
new file mode 100644
index 0000000..41872a9
--- /dev/null
+++ b/conf/chaperone.d/curator-cron.conf
@@ -0,0 +1,5 @@
+curator-cron.service: {
+    type: cron,
+    interval: "19 2 * * *",
+    command: "/usr/bin/curator-cron",
+}
diff --git a/curator-cron b/curator-cron
new file mode 100755
index 0000000..67b6e91
--- /dev/null
+++ b/curator-cron
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+test -x /usr/bin/curator || exit 0
+
+# If you don't set a locale, curator doesn't run.
+export LC_ALL=en_US.UTF-8
+
+find /etc/elasticsearch/actions -type f -name 'maint_*.yml' \
+    | xargs -n 1 curator --config=/etc/elasticsearch/curator.yml
+    >/dev/null 2>&1
+
+exit 0
-- 
GitLab