minideb icon indicating copy to clipboard operation
minideb copied to clipboard

Recommended way to run CRON job

Open dominikkrulak opened this issue 5 years ago • 2 comments

Heard of CRON job and I generally know what it does and I need to run some script in some time intervals.

This is my first encounter with setting up a CRON job on any system. I've studied about it for a while but haven't try it yet.

First I went off from this blog post: Command scheduling with cron on Debian

And than something about to run in Docker: How to run a cron job inside a docker container?

In minideb image I could located /etc/cron.daily where I'll may put files but if I'll need to run CRON job hourly than I couldn't locate /etc/crontab neither crontab executable.

Is there anything I should follow up or avoid to run a CRON job in minideb container?

dominikkrulak avatar Feb 27 '20 19:02 dominikkrulak

Hi,

In order to do this you would need to install a cron package in the container, e.g. anacron.

You would also need to run the daemon in order to have it run your cronjobs. If the container is only to run cronjobs then you can run the cron daemon in the foreground as the main CMD.

If this is to run cronjobs alongside other processes in a container then you will need to run cron in the background, and would need something to start it in your entrypoint.

james-w avatar Mar 16 '20 14:03 james-w

Hi @james-w,

Thank you for the proposal. I'll consider all options and suits it to my needs. I also created very similar issue and may find some pointers there in @dani8art 's comment.

dominikkrulak avatar Mar 17 '20 10:03 dominikkrulak