forked from ddev/ddev-cron
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move to Dockerfile installation (ddev#32)
* Move to Dockerfile installation * fix README typos * Update readme * Update README.md Co-authored-by: Randy Fay <[email protected]> * Update README.md Co-authored-by: Randy Fay <[email protected]> * Update README.md Co-authored-by: Randy Fay <[email protected]> * Use `COPY` command because it's preferred https://www.geeksforgeeks.org/difference-between-the-copy-and-add-commands-in-a-dockerfile/ * Dynamically add `.cron` files * Concatenate project cron jobs * attempt to add cron jobs to current user * centralize health checks and example tests * Fix COPY command preventing multiple jobs * Fix typo Co-authored-by: Randy Fay <[email protected]> * Remove repeated section Co-authored-by: Randy Fay <[email protected]> * Remove requirement statement Co-authored-by: Randy Fay <[email protected]> * Use `crontab -l` in example because it is simpler * Remove customize instructions * Remove extra line --------- Co-authored-by: tyler36 <[email protected]> Co-authored-by: Randy Fay <[email protected]>
- Loading branch information
1 parent
467a445
commit d417d98
Showing
7 changed files
with
142 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,18 @@ | ||
#ddev-generated | ||
# Install cron package; this can be done in webimage_extra_packages, but put it here for now. | ||
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y -o Dpkg::Options::="--force-confold" --no-install-recommends --no-install-suggests cron | ||
# Tell supervisord to start cron service in cron.conf | ||
RUN echo " \n \ | ||
[program:cron] \n \ | ||
command=sudo /usr/sbin/cron -f -L7 \n \ | ||
autorestart=true \n \ | ||
startretries=10 \n \ | ||
stdout_logfile=/proc/self/fd/2 \n \ | ||
stdout_logfile_maxbytes=0 \n \ | ||
redirect_stderr=true \n \ | ||
" > /etc/supervisor/conf.d/cron.conf | ||
|
||
# Copy our custom config | ||
COPY ./cron.conf /etc/supervisor/conf.d/cron.conf | ||
|
||
# Make it so you can add to cron.d without root privileges | ||
RUN chmod 777 /etc/cron.d /var/run | ||
|
||
# Copy over our custom jobs | ||
COPY ./*.cron /etc/cron.d/ | ||
|
||
# Give execution rights on the cron jobs | ||
RUN chmod -f 0644 /etc/cron.d/*.cron || true | ||
|
||
# Concatenate files | ||
RUN { cat /etc/cron.d/*.cron; } | crontab -u ${username} - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#ddev-generated | ||
[program:cron] | ||
command=sudo /usr/sbin/cron -f -L7 | ||
autorestart=true | ||
startretries=10 | ||
stdout_logfile=/proc/self/fd/2 | ||
stdout_logfile_maxbytes=0 | ||
redirect_stderr=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#ddev-generated | ||
* * * * * date | tee -a /var/www/html/time.log |