diff --git a/Dockerfile b/Dockerfile index 177e105..601c8ed 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM alpine -RUN apk add --no-cache docker bash +RUN apk add --no-cache docker bash tini ENV NEXTCLOUD_EXEC_USER=www-data ENV NEXTCLOUD_CONTAINER_NAME= @@ -10,7 +10,7 @@ ENV NEXTCLOUD_CRON_MINUTE_INTERVAL=15 COPY scripts/*.sh / COPY scripts/cron-scripts /cron-scripts -ENTRYPOINT ["/entrypoint.sh"] +ENTRYPOINT ["tini", "--", "/entrypoint.sh"] HEALTHCHECK --timeout=5s \ CMD ["/healthcheck.sh"] diff --git a/scripts/entrypoint.sh b/scripts/entrypoint.sh index 1fe592c..cc2d028 100755 --- a/scripts/entrypoint.sh +++ b/scripts/entrypoint.sh @@ -27,16 +27,5 @@ echo "$containerId" > /tmp/containerId echo "*/$NEXTCLOUD_CRON_MINUTE_INTERVAL * * * * /cron-tasks.sh $containerId" \ > /var/spool/cron/crontabs/root -# Watch for SIGTERM (someone stops the docker container) so we can tell crond to exit -_term() { - echo "Caught SIGTERM signal!" - kill -TERM "$child" 2>/dev/null -} - -trap _term SIGTERM - -exec crond -f -l 0 & -echo "Started crond" - -child=$! -wait "$child" +echo "Starting crond" +exec crond -f -l 0