Not planned Rebuild corrupted or missing cron job via admin ui

Sim

Well-known member
If something happens to the "cron" job in xf_job (eg it becomes corrupted or missing), then cron entries will not run.

The only way to re-create the cron job is to create or save a cron entry - however, for a server running in production, you cannot edit any existing cron entries without turning on debug mode.

While it is possible to manually create and save a temporary cron entry which will force a reset of the cron job, that's not terribly intuitive or user friendly.

It would be useful to have a simple "rebuild cron job" entry in the admin ui - perhaps in the Rebuild Caches section to force a refresh?

Note that I just helped a user do exactly this - their production server was moved to a new machine by their host and somehow the cron job got corrupted or deleted and so cron tasks had not been running for several days.

After creating and saving a temporary cron task, cron tasks are now executing again.
 
Upvote 0
This suggestion has been closed. Votes are no longer accepted.
On the whole, I don't think we need to take any further steps to account for this. If a server migration somehow misses some data from the DB in one table, then I'd be very worried about the state of the entire database. I can't recall another instance of this happening (with 2.x in particular, which changes the approach so that even if there's some sort of fatal error, the crons will still get picked up).

Beyond that though, you don't actually need to create a temporary cron task -- you can just "edit" one of the existing ones. You can still edit these without debug mode enabled; saving is all you need there. The alternative is just to toggle one on and off via the list page.

Given that this shouldn't ever happen unless there's an explicit action to remove the job (or an incomplete DB transfer), I think that is likely sufficient.
 
with 2.x in particular, which changes the approach so that even if there's some sort of fatal error, the crons will still get picked up

This was with 2.x and crons were not running. I suspect the cron job was completely missing - and tracing through the code I can't see any way that the system will fix itself without the entry in the database?

Anyway - I had indeed missed the fact that you can simply toggle one of the cron tasks to cause a rebuild - that is simple enough I guess.

(and yes, I did express my concerns about the state of the database)
 
Top Bottom