Open ragoon82 opened 4 years ago
have you tried running it manually with:
bin/plugin tntsearch index
Yes, It's working
# bin/plugin tntsearch index
Re-indexing
Language: lt
If you are running on Grav 1.7RC there's an unreleased fix in the develop branch. If you are running PHP 7.4, there might still be some issues.
I am running on Grav 1.6.14, PHP Version 7.3.8
But found problem
And can't solve this.
This is a classic case where your webserver is running under another user (perhaps www
or public_html
), and you have to setup the crontab entry for that user.. Not your user are logging in to the terminal with.
So, I solved one problem - crontab Installed and ready, but job status is failure:
Something else?
I came across this problem as well. It looks like it is because $grav['pages']->init()
is never called when running the scheduler job, so there is no data to index. When using bin/plugin tntsearch index
the pages get initialised through the $this->initializePages()
call in IndexerCommand::serve()
.
I'm not sure if the Grav core should be initialising pages when the scheduler is run, or whether it should be done in the plugin. And I don't know enough about how Grav works to know what call needs to be made to initialise the pages. It looks like events need to be fired etc, so it's not just a matter of calling $grav['pages']->init()
.
My temporary solution is to run bin/plugin tntsearch index
via it's own cronjob and disable the index scheduled job.
Actually, after closer review it looks like the issue ragoon82 was having it different than mine. The job status is success for me but no pages were indexed when the scheduler ran. Pages were only indexed when I ran bin/plugin tntsearch index
. Perhaps I should file this as a separate issue.
I went ahead and filed issue #95 for the problem I'm seeing, as I'm pretty sure it's not that same as this issue.
This should be fixed now.
Grav v1.7.3 - Admin v1.10.2
sorry to resurrect this issue, I'm facing an error with the plugin scheduled re-index 👍
bin/grav scheduler -d
Job Details
===========
┌──────────────────┬──────────────────┬──────────────────┬────────────────────────────────────────────────┐
│ Job ID │ Last Run │ Next Run │ Errors │
├──────────────────┼──────────────────┼──────────────────┼────────────────────────────────────────────────┤
│ tntsearch-index │ 2021-01-28 07:59 │ 2021-01-28 08:00 │ /usr/bin/env: 'php': No such file or directory │
│ automated-backup │ 2021-01-28 07:58 │ 2021-01-29 02:00 │ None │
│ cache-purge │ 2021-01-27 04:00 │ 2021-01-29 04:00 │ None │
│ cache-clear │ 2021-01-27 03:00 │ 2021-01-29 03:00 │ None │
└──────────────────┴──────────────────┴──────────────────┴────────────────────────────────────────────────┘```
error is : /usr/bin/env: 'php': No such file or directory
@Ribero that is not an issue with TNTSearch plugin. The plugin uses a CLI from Grav so you should first try to find out why "/usr/bin/env php" doesn't return anything in your environment. Keep in mind that scheduled tasks under Grav could be run under different user.
@ViliusS,
Thanks for the input.
I can run the index command in CLI with success :
runuser -u www-data php bin/plugin tntsearch index
Re-indexing
Added 1 /
Added 2 /...
[...]
Added 16 /test
Added 17 /operations/configuration-grav
Added 18 /operations/test
Total rows 18
Indexed in 0.2s
All other task scheduled works correctly What is this /usr/bin/env ?
env is a part of coreutils on Linux systems. Grav CLI uses it to detect correct PHP version so you should try "runuser -u www-data bin/plugin tntsearch index"
If you specify PHP binary in this command yourself you do not repeat what Grav does.
I use the official grav docker image and did not changed anything. I activated the scheduling from plugin prefs using Admin Panel.
How to configure the plugin so it use the correct settings ?
I'm not familiar with Grav's docker image, you should check with them. The image is probably missing coreutils.
Sorry but I don't get it:
file /usr/bin/env
/usr/bin/env: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=
deb36ddbfdfb87b97ddfa05d2ad4b17efc6bf850, stripped
So sorry to reiterate but how to enable the plugin scheduler feature ? Where is defined the configuration used to setup the scheduler ?
I feel it should work flawlessly with a vanilla grav instance. I did not made any fancy customization and that is one of the benefits of the container approach: stable and reproducible.
Does running scheduler with "runuser -u www-data bin/plugin tntsearch index" work? (notice a difference from your command earlier)
What does "runuser -u www-data /usr/bin/env php -v" return?
I use runuser
when I test the command line only because I cannot directly login with www-data
user on the linux container (disabled by default).
But the grav scheduler and the contrab are run by the webserver user (www-data) and does not requires using runuser
command.
runuser -u www-data bin/plugin tntsearch index
from command line run as expected
runuser -u www-data /usr/bin/env php -v
runuser: invalid option -- 'v'
Try 'runuser --help' for more information.
I think we should not focus on runuser command
try runuser -u www-data "/usr/bin/env php -v"
If runuser -u www-data bin/plugin tntsearch index
works as expected I have no idea why it doesn't work for you because this is exactly how grav sheduler for this plugin is executed. See here https://github.com/trilbymedia/grav-plugin-tntsearch/blob/7836c86e194af3454fafab9ca0d717813bf3525e/tntsearch.php#L119
Maybe your crontab is running under different user than www-data without env or php in the path?
Hi, I am trying run tnsearch plugin via scheduler job but receive an error. Error description not showing and job status is failure. Manually tnsearch plugin is working correct. How can I solve this problem?
This is scheduler run from console: