From 5a93e2bf4816d13f210aa11a36bbb4a33784d46a Mon Sep 17 00:00:00 2001 From: Pavel Zilke Date: Sun, 1 Sep 2024 18:12:12 +0300 Subject: [PATCH] Docker fix RunOnce --- Dockerfile | 6 ++++-- entrypoint.sh | 11 +++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 69e42fa..783afed 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,8 +15,10 @@ RUN chmod +x /root/entrypoint.sh ENV PATH=$PDI_HOME/data-integration:$PATH +ENTRYPOINT ["/root/entrypoint.sh"] + FROM main AS runonce -CMD ["bash", "-c", ". /root/.env.sh; /opt/pentaho-di/data-integration/kitchen.sh /file:////opt/pentaho-di/mappings/job_general.kjb > /proc/1/fd/1 2>&1"] +ENV RUNONCE=true FROM main AS cron -ENTRYPOINT ["/root/entrypoint.sh"] +ENV RUNONCE=false diff --git a/entrypoint.sh b/entrypoint.sh index 8a4de34..da95f54 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -43,7 +43,10 @@ for F in $(find . -type f); do sed -i "s/Encrypted 2beebdaaa1ac8978aaa54aa72ce93bcc9/$DB_SUBPOENA_PASSWORD/g" $F done; -cat /root/crontab | crontab - -#echo "*/10 * * * * bash -c \". /root/.env.sh; /opt/pentaho-di/data-integration/kitchen.sh /file:////opt/pentaho-di/mappings/job_general.kjb > /proc/1/fd/1 2>&1 \"" | crontab - - -cron -f +if [ $RUNONCE == true ]; then + bash -c ". /root/.env.sh; /opt/pentaho-di/data-integration/kitchen.sh /file:////opt/pentaho-di/mappings/job_general.kjb > /proc/1/fd/1 2>&1" + exit $? +else + cat /root/crontab | crontab - + cron -f +fi