Last active
October 31, 2024 16:30
-
-
Save mhubig/a01276e17496e9fd6648cf426d9ceeec to your computer and use it in GitHub Desktop.
Alpine Linux based cronjob runner
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
FROM alpine:latest | |
RUN apk add --update php python py-pip mysql-client \ | |
&& pip install awscli \ | |
&& rm -rf /var/cache/apk/* | |
RUN touch crontab.tmp \ | |
&& echo '* */6 * * * /usr/bin/php /var/www/partkeepr/app/console partkeepr:cron:run' > crontab.tmp \ | |
&& echo '0 2 * * * /usr/bin/sql_backup' >> crontab.tmp \ | |
&& crontab crontab.tmp \ | |
&& rm -rf crontab.tmp | |
CMD ["/usr/sbin/crond", "-f", "-d", "0"] |
Tested with the latest version, for some reason it doesnt work
/bin/sh: [/usr/sbin/crond,: not found
@getvivekv The last line is at fault, it should be the following:
CMD ["/usr/sbin/crond", "-f", "-d", "0"]
Thank you, you saved my day. Tested and works on Alpine 3.13 with supervisord.
/* Log levels:
* 0 is the most verbose, default 8.
* For some reason, in fact only 5, 7 and 8 are used.
*/
Using it with an online view on some logs:
ENTRYPOINT ["/bin/sh", "-c", "crond -f -d 0 && tail -F /var/log/1.log & tail -F /var/log/2.log"]
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am using this cron in multiple images. ++