XF 2.2 Server based trigger - cron doesn't appear to work for sub-site on same domain/file structure

VBX Co

Well-known member
We've installed an add-on to compress images, which works in batches using a cron job which we've reconfigured to run every 2 mins (we have 1+million images to process).

We noticed it was not running within 2 mins consistently, so after some research on these forums we discovered the "Server based trigger" - using the server's cron process to run outstanding XF jobs every minute.

We added our main site via crontab -e and the job runs as expected:
* * * * * php /home/site/public_html/cmd.php xf:run-jobs >/dev/null 2>&1

When we add a second site - a sub-site of the main forums on the same site - the jobs do not run:
* * * * * php /home/site/public_html/subsite/cmd.php xf:run-jobs >/dev/null 2>&1

If we run them at the command line (without the /dev/null) they both work as expected.

If we run
only the sub-site in the cron it doesn't work.

We've discounted the idea of using the full path to PHP because this changes over time and will, eventually, break the cron entries.

We would have expected this to work okay, since there are two sets of files, config files, databases, etc. and the paths in the forum settings are different and both sites work perfectly well with no problems.

Any idea why the second cron isn't working?
 
Last edited:
Solution
Solved - wanted to have another go at this, since it should be doable ... so after trying * * * * * php (cli but wouldn't work) and * * * * * /usr/bin/php (fast-cgi which wouldn't work), after much searching and looking at other people's crontab/command line issues we finally worked out that we needed to use * * * * * /usr/local/bin/php :)

We haz happy!
Interestingly, it was working overnight and well into this afternoon and has suddenly stopped.

Changed the output to write to a /tmp file:

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

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

So we've put it back to Activity based trigger until we can resolve.
 
Solved - wanted to have another go at this, since it should be doable ... so after trying * * * * * php (cli but wouldn't work) and * * * * * /usr/bin/php (fast-cgi which wouldn't work), after much searching and looking at other people's crontab/command line issues we finally worked out that we needed to use * * * * * /usr/local/bin/php :)

We haz happy!
 
Solution
Back
Top Bottom