From 8b37bbba6bd8a235b92a4b89c11d6ce990694fa4 Mon Sep 17 00:00:00 2001 From: Audrey Jensen Date: Fri, 4 Apr 2025 08:47:46 -0500 Subject: [PATCH] replace cron with supercronic --- dockerfile | 23 +++++++++++++++++------ mysqlCron | 2 +- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/dockerfile b/dockerfile index e1a41c0..125466f 100644 --- a/dockerfile +++ b/dockerfile @@ -1,10 +1,21 @@ FROM mysql:8-debian RUN apt-get update --allow-unauthenticated --allow-insecure-repositories -RUN apt-get -y install -qq --force-yes cron -RUN echo "Log Start" >> /var/log/cron.log +#install supercronic +RUN apt-get -y install --force-yes curl +# Latest releases available at https://github.com/aptible/supercronic/releases +ENV SUPERCRONIC_URL=https://github.com/aptible/supercronic/releases/download/v0.2.33/supercronic-linux-amd64 \ + SUPERCRONIC_SHA1SUM=71b0d58cc53f6bd72cf2f293e09e294b79c666d8 \ + SUPERCRONIC=supercronic-linux-amd64 + +RUN curl -fsSLO "$SUPERCRONIC_URL" \ + && echo "${SUPERCRONIC_SHA1SUM} ${SUPERCRONIC}" | sha1sum -c - \ + && chmod +x "$SUPERCRONIC" \ + && mv "$SUPERCRONIC" "/usr/local/bin/${SUPERCRONIC}" \ + && ln -s "/usr/local/bin/${SUPERCRONIC}" /usr/local/bin/supercronic + RUN mkdir /backup -ADD backup.sh /usr/local/bin/ -ADD mysqlCron /etc/cron.d/mysqlCron -RUN chmod 0644 /etc/cron.d/mysqlCron +ADD backup.sh /usr/local/bin/backup.sh +ADD mysqlCron /srv/mysqlCron +RUN chmod 0644 /srv/mysqlCron RUN chmod 0744 /usr/local/bin/backup.sh -CMD cron && tail -f /var/log/cron.log \ No newline at end of file +CMD supercronic /srv/mysqlCron \ No newline at end of file diff --git a/mysqlCron b/mysqlCron index 85510af..8bd7139 100644 --- a/mysqlCron +++ b/mysqlCron @@ -1,2 +1,2 @@ -50 23 * * * backup.sh >> /var/log/cron.log 2>&1 +50 23 * * * /usr/local/bin/backup.sh #leave this line here \ No newline at end of file