I am having trouble with my cron setup. I am using a dockerized version for nextcloud.
For cron I am using the image nextcloud:fpm-alpine.
The problem is that when mounting the nextcloud stuff inside the cron container the permissions of the files getting changed to user and group xfs. Then, when executing the cron I get a write error because the user www-data is not permitted to write to the files that belong to xfs.
I changed the file permissions inside the cron container to www-data. But then the file permissions in the container for the real extcloud instance changed to some numbers and nextcloud didnt work anymore.
What I then did is to overwrite the crontab of www-data to an empy one and of xfs to the content if the www-data cron file.
Now the logs of the cron container are as follows:
But in my nextcloud webgui still says that cron wasnt executed. But why?
I hope you can help me, thanks in advance
EDIT: In the web it said that some jobs were not executed for a few days with a red color but it switch now to 10 months with a orange color
EDIT2: its back to red again it says that the last background job was before 3 hours
same issue with same image. Using cron from the official examples:
cron:
image: nextcloud:fpm-alpine
restart: always
volumes:
- nextcloud:/var/www/html # same as my "app" service
entrypoint: /cron.sh
depends_on:
- db
- redis
I’ve been playing with a clean “install” of docker stack and I notice the following:
$ docker-compose exec cron ls -l /var/www/html/
total 152
...
-rw-r--r-- 1 www-data root 3900 Mar 29 19:39 console.php
drwxr-xr-x 22 www-data root 4096 Mar 29 19:39 core
-rw-r--r-- 1 www-data root 5122 Mar 29 19:39 cron.php
drwxr-xr-x 2 root root 4096 Mar 29 19:39 custom_apps
drwxrwx--- 4 www-data root 4096 Mar 29 19:48 data
...
compared to
$ docker-compose exec app ls -l /var/www/html/
total 152
...
-rw-r--r-- 1 www-data root 3900 Mar 29 19:39 console.php
drwxr-xr-x 22 www-data root 4096 Mar 29 19:39 core
-rw-r--r-- 1 www-data root 5122 Mar 29 19:39 cron.php
drwxr-xr-x 53 www-data root 4096 Mar 29 20:26 custom_apps
drwxrwx--- 4 www-data root 4096 Mar 29 19:48 data
...
And the error i get from the cron container logs:
crond: wakeup dt=10
crond: wakeup dt=50
crond: file www-data:
crond: line php -f /var/www/html/cron.php
crond: wakeup dt=60
crond: file www-data:
crond: line php -f /var/www/html/cron.php
crond: wakeup dt=60
crond: file www-data:
crond: line php -f /var/www/html/cron.php
crond: wakeup dt=60
crond: file www-data:
crond: line php -f /var/www/html/cron.php
crond: wakeup dt=60
crond: file www-data:
crond: line php -f /var/www/html/cron.php
crond: job: 0 php -f /var/www/html/cron.php
crond: child running /bin/ash
crond: USER www-data pid 52 cmd php -f /var/www/html/cron.php
Cannot write into "apps" directory
This can usually be fixed by giving the webserver write access to the apps directory or disabling the appstore in the config file.
I’m scratching my head for a while since there’s not much to go on with the cron service as per examples. But maybe there’s extra steps to take with the alpine image?