Created
August 15, 2017 20:54
-
-
Save h2rd/fe73f565e8f2e40f4e06e003f2a60cde to your computer and use it in GitHub Desktop.
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
0 1 * * * root . /root/envs.sh;/bin/backup.sh >> /var/log/cron.log 2>&1 |
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 ubuntu:latest | |
ADD start.sh /bin/start.sh | |
RUN chmod +x /bin/start.sh | |
# Add crontab file in the cron directory | |
ADD crontab /etc/cron.d/thecron | |
# Give execution rights on the cron job | |
RUN chmod 0644 /etc/cron.d/thecron | |
# Create the log file to be able to run tail | |
RUN touch /var/log/cron.log | |
# start script | |
CMD /bin/bash /bin/start.sh |
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
# export all environment variables to use in cron | |
env | sed 's/^\(.*\)$/export \1/g' > /root/envs.sh | |
chmod +x /root/envs.sh | |
# Run the command on container startup | |
cron && tail -f /var/log/cron.log |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment