Error message from elgg-cli during execution from cron

i checked my settings.php

$CONFIG->simplecache_enabled = true;
$CONFIG->cacheroot = "/var/data/elgg-cache";

/var/data/elgg-cache and my data-directory are both owned by www-data and are writable

any suggestions what I am doing wrong ?

An error occured during the execution of the command '/var/www/vhosts/blueball.ddnss.de/vendor/elgg/elgg/elgg-cli': Cache path is
not writable.
 CRITICAL: Exception at time 1594231202:
Stash\Exception\InvalidArgumentException: Cache path is not writable. in /var/www/vhosts/blueball.ddnss.de/vendor/tedivm/stash/src
/Stash/Utilities.php:227
Stack trace:
#0 /var/www/vhosts/blueball.ddnss.de/vendor/tedivm/stash/src/Stash/Driver/FileSystem.php(171): Stash\Utilities::checkFileSystemPer
missions()
#1 /var/www/vhosts/blueball.ddnss.de/vendor/tedivm/stash/src/Stash/Driver/AbstractDriver.php(39): Stash\Driver\FileSystem->setOpti
ons()
#2 /var/www/vhosts/blueball.ddnss.de/vendor/elgg/elgg/engine/classes/Elgg/Cache/CompositeCache.php(350): Stash\Driver\AbstractDriv
er->__construct()
#3 /var/www/vhosts/blueball.ddnss.de/vendor/elgg/elgg/engine/classes/Elgg/Cache/CompositeCache.php(251): Elgg\Cache\CompositeCache
->buildFileSystemDriver()
#4 /var/www/vhosts/blueball.ddnss.de/vendor/elgg/elgg/engine/classes/Elgg/Cache/CompositeCache.php(71): Elgg\Cache\CompositeCache-
>createPool()
#5 /var/www/vhosts/blueball.ddnss.de/vendor/elgg/elgg/engine/classes/Elgg/Di/ServiceProvider.php(393): Elgg\Cache\CompositeCache->
__construct()
#6 [internal function]: Elgg\Di\ServiceProvider->Elgg\Di\{closure}()
#7 /var/www/vhosts/blueball.ddnss.de/vendor/elgg/elgg/engine/classes/Elgg/Di/DiContainer.php(68): call_user_func()
#8 /var/www/vhosts/blueball.ddnss.de/vendor/elgg/elgg/engine/classes/Elgg/Di/DiContainer.php(48): Elgg\Di\DiContainer->build()
#9 /var/www/vhosts/blueball.ddnss.de/vendor/elgg/elgg/engine/classes/Elgg/Di/ServiceProvider.php(151): Elgg\Di\DiContainer->__get(
)
#10 [internal function]: Elgg\Di\ServiceProvider->Elgg\Di\{closure}()
#11 /var/www/vhosts/blueball.ddnss.de/vendor/elgg/elgg/engine/classes/Elgg/Di/DiContainer.php(68): call_user_func()
#12 /var/www/vhosts/blueball.ddnss.de/vendor/elgg/elgg/engine/classes/Elgg/Di/DiContainer.php(48): Elgg\Di\DiContainer->build()
#13 /var/www/vhosts/blueball.ddnss.de/vendor/elgg/elgg/engine/classes/Elgg/Application/ShutdownHandler.php(104): Elgg\Di\DiContain
er->__get()
#14 /var/www/vhosts/blueball.ddnss.de/vendor/elgg/elgg/engine/classes/Elgg/Application/ShutdownHandler.php(44): Elgg\Application\S
hutdownHandler->persistCaches()
#15 [internal function]: Elgg\Application\ShutdownHandler->__invoke()
#16 {main}
  • oh, sorry ... i put it in the wrong crontab ... with the root users crontab all is fine :-/

  • From my experience you need to be careful with calling cronjobs of Elgg via elgg-cli. As you noticed, you need to run it as root for the script to work. Problem then is that any new files and folders in the data directory (e.g. log files) are created with root as owner and corresponding (limited) permissions. Quite likely, the webserver (not running as root user) can't fully access these files/folders. This might result in cronjobs not running in the future (I had the problem that it worked once but then stopped working and it took me quite some time to understand what was wrong) or it might not work correctly to see the log output on the cron status page in the admin area of your site. The only "solution" working for me was to return to old Elgg 2 way of calling the cronjobs (by calling the corresponding url pagehandlers via wget).

  • > The only "solution" working for me was to return to old Elgg 2 way of calling the cronjobs (by calling the corresponding url pagehandlers via wget).

    My solution to that is now running the cronjob in the system crontab (/etc/cron.d) with user www-data. Before i had a lot entries in apaches error.log, that accessing the cache failed for several files with "permission denied". These files belonged to root:root. Since changing the cronjob from root to www-data i dont haave these fails anymore.