Cron-Job: files:scan --all

Hello,

I want to start a Cron-Job like: php /home/xxx/OwnCloud/occ files:scan --all

But the error message is: This script can be run from the command line only

Is there a way, ot start “files:scan --all” with cron?

Hi @Heinzi,

try using the full path for php

/usr/bin/php -f /home/xxx/OwnCloud/occ system:cron

Cheers
Erwin Palma

1 Like

Hm, okay. This works:

/usr/bin/php -f /home/hofmannw/public_html/OwnCloud/occ system:cron files:scan --all

But the result is a little bit too much for me:

Internal Server Error

The server encountered an internal error and was unable to complete your request.

Please contact the server administrator if this error reappears multiple times and include the technical details below in your report.

An unhandled exception has been thrown:

TypeError: Argument 2 passed to Symfony\Component\Routing\RequestContext::__construct() must be of the type string, null given, called in /home/xxx/public_html/OwnCloud/lib/private/Route/Router.php on line 86 and defined in /home/xxx/public_html/OwnCloud/lib/composer/symfony/routing/RequestContext.php:36

Stack trace:

#0 /home/xxx/public_html/OwnCloud/lib/private/Route/Router.php(86): Symfony\Component\Routing\RequestContext->__construct(’/index.php’, NULL, ‘localhost’, ‘http’)

#1 /home/xxx/public_html/OwnCloud/lib/private/Route/CachingRouter.php(42): OC\Route\Router->__construct(Object(OC\Log))

#2 /home/xxx/public_html/OwnCloud/lib/private/Server.php(501): OC\Route\CachingRouter->__construct(Object(OC\Memcache\APCu), Object(OC\Log))

#3 /home/xxx/public_html/OwnCloud/lib/composer/pimple/pimple/src/Pimple/Container.php(118): OC\Server->OC{closure}(Object(OC\Server))

#4 /home/xxx/public_html/OwnCloud/lib/private/AppFramework/Utility/SimpleContainer.php(108): Pimple\Container->offsetGet(‘Router’)

#5 /home/xxx/public_html/OwnCloud/lib/private/ServerContainer.php(86): OC\AppFramework\Utility\SimpleContainer->query(‘Router’)

#6 /home/xxx/public_html/OwnCloud/lib/private/Server.php(1287): OC\ServerContainer->query(‘Router’)

#7 /home/xxx/public_html/OwnCloud/lib/private/Server.php(426): OC\Server->getRouter()

#8 /home/xxx/public_html/OwnCloud/lib/composer/pimple/pimple/src/Pimple/Container.php(118): OC\Server->OC{closure}(Object(OC\Server))

#9 /home/xxx/public_html/OwnCloud/lib/private/AppFramework/Utility/SimpleContainer.php(108): Pimple\Container->offsetGet(‘URLGenerator’)

#10 /home/xxx/public_html/OwnCloud/lib/private/ServerContainer.php(86): OC\AppFramework\Utility\SimpleContainer->query(‘URLGenerator’)

#11 /home/xxx/public_html/OwnCloud/lib/private/Server.php(1194): OC\ServerContainer->query(‘URLGenerator’)

#12 /home/xxx/public_html/OwnCloud/lib/private/legacy/template/functions.php(157): OC\Server->getURLGenerator()

#13 /home/xxx/public_html/OwnCloud/core/templates/exception.php(11): link_to_docs(‘admin-logfiles’)

#14 /home/xxx/public_html/OwnCloud/lib/private/Template/Base.php(226): include(’/home/xxx/…’)

#15 /home/xxx/public_html/OwnCloud/lib/private/Template/Base.php(194): OC\Template\Base->load(’/home/xxx/…’, NULL)

#16 /home/xxx/public_html/OwnCloud/lib/private/legacy/template.php(236): OC\Template\Base->fetchPage(NULL)

#17 /home/xxx/public_html/OwnCloud/lib/private/Template/Base.php(176): OC_Template->fetchPage()

#18 /home/xxx/public_html/OwnCloud/lib/private/legacy/template.php(381): OC\Template\Base->printPage()

#19 /home/xxx/public_html/OwnCloud/lib/base.php(438): OC_Template::printExceptionErrorPage(Object(Exception))

#20 /home/xxx/public_html/OwnCloud/lib/base.php(587): OC::initSession()

#21 /home/xxx/public_html/OwnCloud/lib/base.php(1060): OC::init()

#22 /home/xxx/public_html/OwnCloud/console.php(74): require_once(’/home/xxx/…’)

#23 /home/xxx/public_html/OwnCloud/occ(10): require_once(’/home/xxx/…’)

#24 {main}

I see,

Have you activated REDIS into the ownCoud?
Have you installed the redis server?

Cheers
Erwin

1 Like

No, I don’t think this. Search “REDIS” only files named “PredisCache.php” are found. And I do not know, what is REDIS good for either.

I think this question is beyond my technical ability. I don’t know much about php and linux. Then I will continue to start the command "files:scan --all "manually.

Hey,

i think it could be possible that your PHP installation has an uncommon setup where the php binary isn’t really the correct PHP client binary. Maybe you need to call something like php-cli or similar instead (i had read from that in the past).

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.