Last active
January 9, 2023 07:40
-
-
Save vnext-nguyen-quyen/eb97f19381dec585522c253dc23399b0 to your computer and use it in GitHub Desktop.
Revisions
-
vnext-nguyen-quyen renamed this gist
Jan 9, 2023 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
vnext-nguyen-quyen created this gist
Jan 9, 2023 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,45 @@ 1. Alpine (No need for redirection) using the default cron utility (busybox) ## Dockerfile ===== FROM alpine:3.7 # Setting up crontab COPY crontab /tmp/crontab RUN cat /tmp/crontab > /etc/crontabs/root CMD ["crond", "-f", "-l", "2"] ===== ## Crontab ===== * * * * * echo "Crontab is working - watchdog 1" ===== 2. Centos Redirection to /proc/1/fd/1 inside the crontab declaration line ## Dockerfile ===== FROM centos:7 RUN yum -y install crontabs ADD crontab /etc/cron.d/crontab RUN chmod 0644 /etc/cron.d/crontab RUN crontab /etc/cron.d/crontab CMD ["crond", "-n"] ===== ## Crontab ===== * * * * * echo "Crontab is working - watchdog 1" > /proc/1/fd/1 ===== => Test show cron ouput with docker logs {container_name}