CLI Job / Cron Runner

CLI Job / Cron Runner 2.1.0

No permission to download
Note that after installing the latest version, if you are seeing the message "There are scheduled jobs outstanding which have not run. Jobs may not be getting triggered when expected."

View attachment 236235

... check to see whether you are still using the --time command line option.

This option has been renamed to --max-execution-time to match the option names used in the core job runner.

Make sure you have updated all of your cron tasks to use --max-execution-time
Hi @Sim,

thank you for this great addon. I am using it and most times I visit admin.php I see that message. But cron jobs are executed (as I can see when I visit admin.php?cron/). We have a lot of background-jobs working and set --max-execution-time=240.

So, my guess is, that every time a cron runs longer than 1 minute (which seems to happen quite frequently), we get this message, because the next jobs are already waiting.

Can that be the case?
 
Hi @Sim,

thank you for this great addon. I am using it and most times I visit admin.php I see that message. But cron jobs are executed (as I can see when I visit admin.php?cron/). We have a lot of background-jobs working and set --max-execution-time=240.

So, my guess is, that every time a cron runs longer than 1 minute (which seems to happen quite frequently), we get this message, because the next jobs are already waiting.

Can that be the case?

Yes, the system generally only processes one task at a time, so if there are tasks which are taking longer than 1 minute then you'll likely see the message.

In particular if you have any Cron tasks which are scheduled to run every minute - you'll probably get this message a lot, since there will almost always be a Job outstanding to trigger the Cron tasks.

You can check on which jobs are outstanding by running the hg:show-jobs command from the CLI - it lists the next run time for any outstanding jobs, and shows the current time (according to the forums) at the bottom, so you can tell whether the job is delayed or still pending.
 
I see. That's quite annoying. This message also hides any outstanding manual jobs (i.e. you cannot see both "outstanding" messages, cron and manual tasks, at the same time; at least that's my experience).

Is it possible to show this message only if jobs are outstanding for at least X minutes?
 
Is it possible to just run one job, a job that has no cron?
Then I could just add one file to the server and say: go, baby, go!
 
Is it possible to just run one job, a job that has no cron?
Then I could just add one file to the server and say: go, baby, go!

No - jobs don't work like that, you need to create a job entry in the database for the job to run.

If you have a single simple task you need to execute, just create a cron without a job and execute the cron manually using the hg:run-cron tool I decribe on the overview page.

Better yet, just create a CLI command and run that directly - you'll have a lot more control over things.

Perhaps if you describe what you are trying to achieve I can suggest the best method for executing it?
 
Thank you, have done it with a template-mod and a switch in the rebuild-tools.


What I would like to have?

Sometimes i use php to do something because it is faster to write. Example from today:
open DB, fetch all resources, fetch the thread, copy the resource_icons/[floor_int]/res_id... to thread_icon/[another_floor_int]/thread_id...

Called by website.com/xyz/icon.php

It would be nice to do it as a class and throw it into /addons/me/MyTools/Job/name_of_tool.php
and call it by

... cmd.php xf:magic_power /me/MyTools/Job/name_of_tool
to have the same result like using website.com/xyz/name_of_tool.php

But for next time i have now this dummy add-on and just rename the needed class from "tool_for_copy_pictures" to "active_tool" and start it by rebuild.
 
I create CLI commands for one-off tasks - easy to run, easy to debug, and no timeout issues compared to running something through the browser.
 
Top Bottom