Cron / Periodic tasks?

Hi All,

Looking at migrating and existing Rasberry pi (2) product to resin.io. The code is already dockerized so looks like this should be an easy transition (Thank you!!).

I do have one sticking point currently. The application itself also has need of a couple of periodic tasks. Currently this is handled by registering cron jobs on the host pi that just runs the docker image with the correct command line.

Is this something that is possible with resin.io? Or would I need to come up with an alternative solution that is hosted within the image itself? Something I would rather avoid as running multiple processes inside a docker containers isn’t really how they are supposed to be used.

Thanks

Hey,

That should be possible though it will involve the use of a single container (currently we only support a single container running on the device but in the future plan to allow multiple container applications.)

I’m experimenting now to see what I can come up with for you :smile: will let you know when I have something!

Best, Lorenzo

Hey again,

I’ve created an example repo - https://github.com/resin-io-projects/cron-example - which gives an example of configuring cron on a raspberry pi 2 (adjust the base image according to our base image docs if you need to port this to a different device.)

You can also alternatively use systemd timers to achieve the same thing, it’s a little more involved but doesn’t require any external packages whatsoever.

Best, Lorenzo

Thank @ljs, much appreciated. I’ll take a look and see what we can do.

@moose have you had any luck making it work? Been playing with systemd timers myself, just wondering if there are some good real-world projects using such periodic tasks.