Skip to content

Commit

Permalink
Merge pull request #4 from dskaggs/bugfix/crontab-option-fails
Browse files Browse the repository at this point in the history
Bugfix/crontab option fails
Fixes #3
  • Loading branch information
dskaggs authored Apr 11, 2020
2 parents 2306508 + 59c40c2 commit 166d4a4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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 /
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions scripts/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 166d4a4

Please sign in to comment.