log crond output, remove 1000 userid

This commit is contained in:
Fco. Javier Delgado del Hoyo 2021-05-09 11:28:53 +02:00
parent 33c570f26d
commit 89bb6f185e
3 changed files with 10 additions and 8 deletions

View file

@ -3,7 +3,9 @@ RUN apk -U add openssl git
ARG DOCKERIZE_VERSION=v0.6.1
WORKDIR /go/src/github.com/jwilder
RUN git clone https://github.com/jwilder/dockerize.git && cd dockerize && git checkout ${DOCKERIZE_VERSION}
RUN git clone https://github.com/jwilder/dockerize.git && \
cd dockerize && \
git checkout ${DOCKERIZE_VERSION}
WORKDIR /go/src/github.com/jwilder/dockerize
RUN go get github.com/robfig/glock
@ -31,11 +33,11 @@ ENV CRON_TIME="0 3 * * sun" \
TIMEOUT="10s"
COPY ["run.sh", "backup.sh", "restore.sh", "/"]
RUN mkdir /backup && \
RUN mkdir /backup && \
chmod 777 /backup && \
chmod 755 /run.sh /backup.sh /restore.sh && \
touch /mysql_backup.log && \
chmod 666 /mysql_backup.log && \
adduser -S -u 1000 -g 100 cronuser
chmod 666 /mysql_backup.log
VOLUME ["/backup"]

View file

@ -19,7 +19,7 @@ do
gzip "-$GZIP_LEVEL" -f "$FILENAME"
echo "==> Creating symlink to latest backup: $(basename "$FILENAME".gz)"
rm "$LATEST" 2> /dev/null
cd /backup || exit && ln -s "$(basename "$FILENAME".gz)" "$(basename "$LATEST")" && cd - || exit
cd /backup || exit && ln -s "$(basename "$FILENAME".gz)" "$(basename "$LATEST")"
DB_COUNTER=$(( DB_COUNTER + 1 ))
else
rm -rf "$FILENAME"

6
run.sh
View file

@ -11,10 +11,10 @@ elif [ -n "${INIT_RESTORE_LATEST}" ]; then
echo "waiting database container..."
sleep 1
done
find /backup -maxdepth 1 -name '*.sql.gz' | tail -1 | xargs /restore.sh
find /backup -maxdepth 1 -name '*.sql.gz' | tail -1 | xargs /restore.sh
fi
echo "${CRON_TIME} /backup.sh >> /mysql_backup.log 2>&1" > /tmp/crontab.conf
crontab /tmp/crontab.conf
echo "=> Running cron task manager"
exec crond -f
echo "=> Running cron task manager in foreground"
exec crond -f -l 8 -L /mysql_backup.log