diff --git a/Dockerfile b/Dockerfile index 9c6f289..97d7a6f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,8 @@ FROM python:3.8-slim +RUN apt-get update +RUN apt-get install cron -y +RUN touch /var/spool/cron/crontabs/root RUN pip3 install -U organize-tool COPY scripts/entrypoint.sh / diff --git a/README.md b/README.md index 2bc9652..dd74e7a 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ docker run -it -v "/source-folder/":/source -v "/destination-folder/":/destination docker-organize - "* * * * * organize run" + "* * * * *" ``` The final line in the example above sets a crontab entry to run Organize once every minute. diff --git a/scripts/entrypoint.sh b/scripts/entrypoint.sh index edcba66..3bd7b01 100644 --- a/scripts/entrypoint.sh +++ b/scripts/entrypoint.sh @@ -1,9 +1,9 @@ #!/bin/sh -set -e if [ $# -eq 1 ] then - echo "$1" | crontab - && crond -f -L - + (crontab -l 2>/dev/null; echo "$1 /usr/local/bin/organize run >> /var/log/organize/organize.log 2>&1") | crontab - + service cron restart else - organize run && exit 0 + organize run && exit 0 fi \ No newline at end of file