CLI Job Runner for XF 2.1

CLI Job Runner for XF 2.1 1.5.0

No permission to download
Which version of the addon are you running?

If you are running 1.4.0 or later, you can disable the CLI based trigger by changing the Job run trigger in the Job Runner options to "Activity based trigger" (this mimics the new core behaviour in XF 2.2).

Not sure if that will achieve what you need?
 
On latest 2.1 update running latest CLI Job Runner 1.5.0, I am getting this error when I run the command manually?

Code:
php /path/to/cmd.php xf:run-jobs
Command "xf:run-jobs" is not defined.

ah didn't read your update log that it changed to hg:run-jobs !
 
  • Like
Reactions: Sim
On latest 2.1 update running latest CLI Job Runner 1.5.0, I am getting this error when I run the command manually?

Code:
php /path/to/cmd.php xf:run-jobs
Command "xf:run-jobs" is not defined.

ah didn't read your update log that it changed to hg:run-jobs !

Yeah, in hindsight, I shouldn't have been using the xf prefix in the first place - and then to make things worse the XF 2.2 core version called their command xf:run-jobs too, so mine really did need to be changed.

Sorry for the inconvenience!
 
FYI, the addon's option still lists old command at /admin.php?options/groups/hampelJobRunner/

Long-running and scheduled tasks are deferred to the job system. By default, activity on the forum triggers these jobs to run. This can be changed to trigger independently of forum activity but additional setup is required.

Note: If you select "Server based trigger" you are required to configure your server (such as with crontab or cron.d) manually to execute the following command once per minute: php /path/to/xf/cmd.php xf:run-jobs
 
  • Like
Reactions: Sim
Here is the cron job I set up after installing this add-on (thank you so much for this add-on by the way, without it I wouldn't be able to sync my Discord users to XenForo):

Code:
0 6 * * * /usr/bin/php $HOME/public_html/cmd.php -- xf-rebuild:users | tee /tmp/xf_rebuild_users.log

However, I am running into an issue with this cron job though, the output file says:

Code:
Content-type: text/html; charset=UTF-8

This script can only be run via the command line interface.

Do you know why it's giving this message?

I discovered two things. Firstly, my /usr/bin/php is not in fact a binary but is rather, a shell script managed by cPanel.

Secondly, my PHP_SAPI constant is set to "cgi-fcgi" instead of "cli" so the script dies. I found a Stack Overflow answer on it:


Still looking for a fix.
 
Last edited:
Sounds like you are running the wrong script.

From the CLI, run the command which php - this should tell you the path to the CLI version.

If this returns /usr/bin/php, then your path might be set up incorrectly. Take a look in /usr/local/bin/php if this exists - try using that path for your cron?

BTW - when I run php -v I get the following output:

Bash:
# php -v
PHP 7.4.8 (cli) (built: Jul 13 2020 16:46:22) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.8, Copyright (c), by Zend Technologies
    with Xdebug v2.9.6, Copyright (c) 2002-2020, by Derick Rethans

Note the (cli) just after the version.
 
Top Bottom