On an ubuntu machine, I have a crontab that I am setting up with a Dockerfile:
...
RUN apt-get update && apt-get install -y cron
...
ADD crontab /etc/cron.d/crontab
RUN chmod 0644 /etc/cron.d/crontab
RUN systemctl enable cron
RUN touch /etc/cron.d/crontab
crontab:
15 17 * * * root /home/misc/runSomething.sh
It is not firing on schedule after the container is created, however if I manually edit the file with vi to test it, it works afterwards. Its not until it gets edited that it seems to be picked up. Does anyone have an idea regarding how to fix this?
Note that the ownership, etc doesn't see to be changing as a result of the edit:
root@machine:/home/gradle/src# ls -la /etc/cron.d
...
-rw-r--r-- 1 root root 50 Feb 3 14:55 crontab
...
root@machine:/home/gradle/src# vi /etc/cron.d/crontab
...
root@machine:/home/gradle/src# ls -la /etc/cron.d
...
-rw-r--r-- 1 root root 51 Feb 3 15:42 crontab