Cron rake task help


(Sedrickcz) #1

I have old instance of Discourse and I created here three cron rake task, which handles automatic assignment to specific group, automatic import from my other site and update user titles if they change it on our website.

Is there any way how can I preserve this rake task after I update to new version of Discourse? I guess If I create them again, they will disappear after next update, right?

Thank you.


(Robin Ward) #2

It depends how you have your updates set up. If the rake task is within your docker container you can expect it to be blown away on update.

We prefer using plugins for things like that, and check the plugins into git and have them checked out when the site is updated. Of course, you might also have some issues if internal APIs change that your rake task uses.


(Sam Saffron) #3

We run cron inside our docker images, so you can use standard cron to fire it off, you would need to amend the template to place the cron configuration inside the container so it would be there after rebuild.

However, as @eviltrout said our scheduled job API is usually a far better fit and would give you better visibility into the job runs.


(Muzammil Ahmed) #4

How can I build cron which fetch all users replies on topics with in 24 hours. And how to integrate into discourse dockerfile?