Cron container doesn't refresh the cron status

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version: 21.0.2
Operating system and version: Raspberry Pi OS
Apache or nginx version: Nginx 1.21.0
PHP version: 7.4.20

Hi,

I have a setup of Nextcloud based on Docker on my RPi 4. My docker-compose is:

version: '3'

services:

  proxy:
    image: jwilder/nginx-proxy:alpine
    labels:
      - "com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy=true"
    container_name: nextcloud-proxy
    networks:
      - nextcloud_network
    ports:
      - 80:80
      - 443:443
    volumes:
      - ./proxy/conf.d:/etc/nginx/conf.d:rw
      - ./proxy/vhost.d:/etc/nginx/vhost.d:rw
      - ./proxy/html:/usr/share/nginx/html:rw
      - ./proxy/certs:/etc/nginx/certs:ro
      - /etc/localtime:/etc/localtime:ro
      - /var/run/docker.sock:/tmp/docker.sock:ro
      - ./nginx.conf:/etc/nginx/nginx.conf
    restart: unless-stopped

  letsencrypt:
    image: jrcs/letsencrypt-nginx-proxy-companion
    container_name: nextcloud-letsencrypt
    depends_on:
      - proxy
    networks:
      - nextcloud_network
    volumes:
      - ./proxy/certs:/etc/nginx/certs:rw
      - ./proxy/vhost.d:/etc/nginx/vhost.d:rw
      - ./proxy/html:/usr/share/nginx/html:rw
      - /etc/localtime:/etc/localtime:ro
      - /var/run/docker.sock:/var/run/docker.sock:ro
    restart: unless-stopped

  db:
    image: jsurf/rpi-mariadb
    container_name: nextcloud-mariadb
    networks:
      - nextcloud_network
    volumes:
      - db:/var/lib/mysql
      - /etc/localtime:/etc/localtime:ro
    environment:
      - MYSQL_ROOT_PASSWORD=edited
      - MYSQL_PASSWORD=edited
      - MYSQL_DATABASE=edited
      - MYSQL_USER=edited
    restart: unless-stopped

  app:
    image: nextcloud:latest
    container_name: nextcloud-app
    networks:
      - nextcloud_network
    depends_on:
      - letsencrypt
      - proxy
      - db
    volumes:
      - nextcloud:/var/www/html
      - /etc/localtime:/etc/localtime:ro
      - /srv/dev-disk-by-uuid-73f9565d-3fe0-4d70-bdd1-45637a9de286:/var/www/html/data/wd-external-drive
    environment:
      - VIRTUAL_HOST=edited
      - LETSENCRYPT_HOST=edited
      - LETSENCRYPT_EMAIL=edited
    restart: unless-stopped

  cron:
    image: nextcloud:latest
    restart: always
    volumes:
      - nextcloud:/var/www/html
    entrypoint: /cron.sh
    depends_on:
      - db

volumes:
  nextcloud:
  db:

networks:
  nextcloud_network:

Logs from cron containers are as follows:

2021-06-25T13:15:00.105495000Z crond: wakeup dt=60
2021-06-25T13:15:00.106735000Z crond: file www-data:
2021-06-25T13:15:00.107006000Z crond:  line php -f /var/www/html/cron.php
2021-06-25T13:15:00.107242000Z crond:  job: 0 php -f /var/www/html/cron.php
2021-06-25T13:15:00.107506000Z crond: child running /bin/bash
2021-06-25T13:15:00.107741000Z crond: USER www-data pid  14 cmd php -f /var/www/html/cron.php
2021-06-25T13:15:10.106517000Z crond: wakeup dt=10
2021-06-25T13:15:20.106756000Z crond: wakeup dt=10
2021-06-25T13:15:30.107278000Z crond: wakeup dt=10
2021-06-25T13:16:00.107891000Z crond: wakeup dt=30
2021-06-25T13:16:00.109527000Z crond: file www-data:
2021-06-25T13:16:00.109971000Z crond:  line php -f /var/www/html/cron.php
2021-06-25T13:17:00.107908000Z crond: wakeup dt=60
2021-06-25T13:17:00.108835000Z crond: file www-data:
2021-06-25T13:17:00.109118000Z crond:  line php -f /var/www/html/cron.php
2021-06-25T13:18:00.108189000Z crond: wakeup dt=60
2021-06-25T13:18:00.109158000Z crond: file www-data:
2021-06-25T13:18:00.109486000Z crond:  line php -f /var/www/html/cron.php
2021-06-25T13:19:00.108599000Z crond: wakeup dt=60
2021-06-25T13:19:00.109506000Z crond: file www-data:
2021-06-25T13:19:00.109750000Z crond:  line php -f /var/www/html/cron.php
2021-06-25T13:20:00.109675000Z crond: wakeup dt=60
2021-06-25T13:20:00.112214000Z crond: file www-data:
2021-06-25T13:20:00.112840000Z crond:  line php -f /var/www/html/cron.php
2021-06-25T13:20:00.113401000Z crond:  job: 0 php -f /var/www/html/cron.php
2021-06-25T13:20:00.114070000Z crond: child running /bin/bash
2021-06-25T13:20:00.114673000Z crond: USER www-data pid  15 cmd php -f /var/www/html/cron.php
2021-06-25T13:20:10.110424000Z crond: wakeup dt=10
2021-06-25T13:21:00.111591000Z crond: wakeup dt=50
2021-06-25T13:21:00.113522000Z crond: file www-data:
2021-06-25T13:21:00.114058000Z crond:  line php -f /var/www/html/cron.php

As you can see, every 5 minutes cron.php is executed just fine.

The issue here is that I see an error on settings page saying that the cron job was not executed for X hours.

After executing docker exec --user www-data nextcloud-app php -f cron.php on host machine, the error goes away.

I’m I missing something here? I’m relatively new to Docker but I know how some of this stuff works.

I had some trouble with Cron with update 21.0.3 in terms of updating. I decided to test webcron out to see if that worked. Webcron worked.

After I installed 21.0.4, I turned Cron back on and it is working again.

I noticed that when I was using Webcron, getting the email to update and function was working much better than Cron.

Any ideas on how to correct Cron to work better with email services?