docker icon indicating copy to clipboard operation
docker copied to clipboard

cron.sh does not actually run any job

Open JMLX42 opened this issue 4 years ago • 3 comments

Steps to reproduce

  1. Use /cron.sh as documented here

Expected behaviour

Cron jobs are expected to be executed.

Actual behaviour

0 cron jobs are ran: select count(*) from jobs; always returns the same value.

Workaround

Running cron.php manually in the app container works as expected:

docker-compose -f /srv/nextcloud/docker-compose.yml exec -u www-data app php -f cron.php

Server configuration

version: '3'

services:
  app:
    image: nextcloud:23.0.0
    restart: unless-stopped
    depends_on:
      - db
      - redis
    volumes:
      - /mnt/nextcloud/html:/var/www/html
      - /mnt/nextcloud/custom_apps:/var/www/html/custom_apps
      - /mnt/nextcloud/config:/var/www/html/config
      - /mnt/nextcloud/data:/var/www/html/data
    networks:
      - server
      - nginx-proxy_reverse-proxy
    environment:
      NEXTCLOUD_ADMIN_USER: "admin"
      NEXTCLOUD_ADMIN_PASSWORD: "<secret>"
      NEXTCLOUD_TRUSTED_DOMAINS: "cloud.example.com app"
      MYSQL_HOST: "db"
      MYSQL_PASSWORD: "<secret>"
      MYSQL_DATABASE: "nextcloud"
      MYSQL_USER: "nextcloud"
      REDIS_HOST: "redis"
      VIRTUAL_HOST: "cloud.example.com"
      VIRTUAL_PORT: "80"
      LETSENCRYPT_HOST: "cloud.example.com"
      APACHE_DISABLE_REWRITE_IP: "1"
  cron:
    image: nextcloud:23.0.0
    restart: unless-stopped
    volumes:
      - /mnt/nextcloud/html:/var/www/html
      - /mnt/nextcloud/custom_apps:/var/www/html/custom_apps
      - /mnt/nextcloud/config:/var/www/html/config
      - /mnt/nextcloud/data:/var/www/html/data
    entrypoint: /cron.sh
    depends_on:
      - db
      - redis
    networks:
      - server
  db:
    image: "mariadb:10.5.11"
    restart: unless-stopped
    environment:
      MARIADB_ROOT_PASSWORD: "<secret>"
      MARIADB_PASSWORD: "<secret>"
      MARIADB_DATABASE: "nextcloud"
      MARIADB_USER: "nextcloud"
    volumes:
      - '/mnt/nextcloud/database:/var/lib/mysql'
    networks:
      - server
  redis:
    image: "redis:6.2.4"
    restart: unless-stopped
    networks:
      - server
    volumes:
      - "/mnt/nextcloud/cache:/data"
  onlyoffice-document-server:
    image: onlyoffice/documentserver:6.4.2
    restart: unless-stopped
    volumes:
      - document_data:/var/www/onlyoffice/Data
      - document_log:/var/log/onlyoffice
    networks:
      - server
      - nginx-proxy_reverse-proxy
    environment:
      VIRTUAL_HOST: "document.cloud.example.com"
      VIRTUAL_PORT: "80"
      LETSENCRYPT_HOST: "document.cloud.example.com"

Operating system: Debian (Docker)

Web server: Apache2

Database: MariaDB 10.5.11

PHP version: 8

Nextcloud version: 23.0.0

Updated from an older Nextcloud/ownCloud or fresh install: updated from 22.0

Where did you install Nextcloud from: Docker

Signing status:

Signing status
No errors have been found.

List of activated apps:

App list
Enabled:
  - accessibility: 1.9.0
  - activity: 2.15.0
  - bruteforcesettings: 2.3.0
  - cloud_federation_api: 1.6.0
  - comments: 1.13.0
  - dashboard: 7.3.0
  - dav: 1.21.0
  - federatedfilesharing: 1.13.0
  - files: 1.18.0
  - files_pdfviewer: 2.4.0
  - files_rightclick: 1.2.0
  - files_sharing: 1.15.0
  - files_trashbin: 1.13.0
  - files_versions: 1.16.0
  - files_videoplayer: 1.12.0
  - logreader: 2.8.0
  - lookup_server_connector: 1.11.0
  - mail: 1.11.5
  - notifications: 2.11.1
  - oauth2: 1.11.0
  - onlyoffice: 7.2.1
  - password_policy: 1.13.0
  - photos: 1.5.0
  - privacy: 1.7.0
  - provisioning_api: 1.13.0
  - recommendations: 1.2.0
  - serverinfo: 1.13.0
  - settings: 1.5.0
  - sharebymail: 1.13.0
  - support: 1.6.0
  - survey_client: 1.11.0
  - systemtags: 1.13.0
  - text: 3.4.0
  - theming: 1.14.0
  - twofactor_backupcodes: 1.12.0
  - updatenotification: 1.13.0
  - user_status: 1.3.1
  - viewer: 1.7.0
  - workflowengine: 2.5.0
Disabled:
  - admin_audit
  - calendar
  - circles
  - contactsinteraction
  - encryption
  - federation
  - files_external
  - firstrunwizard
  - nextcloud_announcements
  - user_ldap
  - weather_status

Nextcloud configuration:

Config report

Are you using external storage, if yes which one: local storage but it's a goofys partition

Are you using encryption: no

Are you using an external user-backend, if yes which one: no

Client configuration

N/A

Logs

cron_1                        | crond: crond (busybox 1.30.1) started, log level 0
cron_1                        | crond: user:www-data entry:(null)
cron_1                        | 100001000010000100001000010000100001000010000100001000010000
cron_1                        | 111111111111111111111111
cron_1                        | 11111111111111111111111111111111
cron_1                        | 111111111111
cron_1                        | 1111111
cron_1                        | crond: user:www-data entry:(null)
cron_1                        | 100001000010000100001000010000100001000010000100001000010000
cron_1                        | 111111111111111111111111
cron_1                        | 11111111111111111111111111111111
cron_1                        | 111111111111
cron_1                        | 1111111
cron_1                        | crond: wakeup dt=6
cron_1                        | crond: file www-data:
cron_1                        | crond:  line php -f /var/www/html/cron.php
cron_1                        | crond: wakeup dt=60
cron_1                        | crond: file www-data:
cron_1                        | crond:  line php -f /var/www/html/cron.php
cron_1                        | crond: wakeup dt=60
cron_1                        | crond: file www-data:
cron_1                        | crond:  line php -f /var/www/html/cron.php
cron_1                        | crond:  job: 0 php -f /var/www/html/cron.php
cron_1                        | crond: child running /bin/bash
cron_1                        | crond: USER www-data pid   8 cmd php -f /var/www/html/cron.php
cron_1                        | PHP Notice:  fwrite(): Write of 3333 bytes failed with errno=95 Operation not supported in /var/www/html/lib/private/Log/File.php on line 89
cron_1                        | Exception: Not installed in /var/www/html/lib/base.php:277
cron_1                        | Stack trace:
cron_1                        | #0 /var/www/html/lib/base.php(649): OC::checkInstalled(Object(OC\SystemConfig))
cron_1                        | nextcloud/server#1 /var/www/html/lib/base.php(1087): OC::init()
cron_1                        | nextcloud/server#2 /var/www/html/cron.php(43): require_once('/var/www/html/l...')
cron_1                        | nextcloud/server#3 {main}
cron_1                        | PHP Notice:  fwrite(): Write of 2306 bytes failed with errno=95 Operation not supported in /var/www/html/lib/private/Log/File.php on line 89
cron_1                        | crond: wakeup dt=10
cron_1                        | crond: wakeup dt=50
cron_1                        | crond: file www-data:
cron_1                        | crond:  line php -f /var/www/html/cron.php
cron_1                        | crond: wakeup dt=60
cron_1                        | crond: file www-data:
cron_1                        | crond:  line php -f /var/www/html/cron.php
cron_1                        | crond: wakeup dt=60
cron_1                        | crond: file www-data:
cron_1                        | crond:  line php -f /var/www/html/cron.php
cron_1                        | crond: wakeup dt=60
cron_1                        | crond: file www-data:
cron_1                        | crond:  line php -f /var/www/html/cron.php
cron_1                        | crond: wakeup dt=60
cron_1                        | crond: file www-data:
cron_1                        | crond:  line php -f /var/www/html/cron.php
cron_1                        | crond:  job: 0 php -f /var/www/html/cron.php
cron_1                        | crond: child running /bin/bash
cron_1                        | crond: USER www-data pid   9 cmd php -f /var/www/html/cron.php
cron_1                        | PHP Notice:  fwrite(): Write of 3333 bytes failed with errno=95 Operation not supported in /var/www/html/lib/private/Log/File.php on line 89
cron_1                        | Exception: Not installed in /var/www/html/lib/base.php:277
cron_1                        | Stack trace:
cron_1                        | #0 /var/www/html/lib/base.php(649): OC::checkInstalled(Object(OC\SystemConfig))
cron_1                        | nextcloud/server#1 /var/www/html/lib/base.php(1087): OC::init()
cron_1                        | nextcloud/server#2 /var/www/html/cron.php(43): require_once('/var/www/html/l...')
cron_1                        | nextcloud/server#3 {main}
cron_1                        | PHP Notice:  fwrite(): Write of 2306 bytes failed with errno=95 Operation not supported in /var/www/html/lib/private/Log/File.php on line 89
cron_1                        | crond: wakeup dt=10
cron_1                        | crond: wakeup dt=50
cron_1                        | crond: file www-data:
cron_1                        | crond:  line php -f /var/www/html/cron.php
cron_1                        | crond: wakeup dt=60
cron_1                        | crond: file www-data:
cron_1                        | crond:  line php -f /var/www/html/cron.php
cron_1                        | crond: wakeup dt=60
cron_1                        | crond: file www-data:
cron_1                        | crond:  line php -f /var/www/html/cron.php
cron_1                        | crond: wakeup dt=60
cron_1                        | crond: file www-data:
cron_1                        | crond:  line php -f /var/www/html/cron.php
cron_1                        | crond: wakeup dt=60
cron_1                        | crond: file www-data:
cron_1                        | crond:  line php -f /var/www/html/cron.php
cron_1                        | crond:  job: 0 php -f /var/www/html/cron.php
cron_1                        | crond: child running /bin/bash
cron_1                        | crond: USER www-data pid  10 cmd php -f /var/www/html/cron.php
cron_1                        | PHP Notice:  fwrite(): Write of 3333 bytes failed with errno=95 Operation not supported in /var/www/html/lib/private/Log/File.php on line 89
cron_1                        | Exception: Not installed in /var/www/html/lib/base.php:277
cron_1                        | Stack trace:
cron_1                        | #0 /var/www/html/lib/base.php(649): OC::checkInstalled(Object(OC\SystemConfig))
cron_1                        | nextcloud/server#1 /var/www/html/lib/base.php(1087): OC::init()
cron_1                        | nextcloud/server#2 /var/www/html/cron.php(43): require_once('/var/www/html/l...')
cron_1                        | nextcloud/server#3 {main}
cron_1                        | PHP Notice:  fwrite(): Write of 2306 bytes failed with errno=95 Operation not supported in /var/www/html/lib/private/Log/File.php on line 89
cron_1                        | crond: wakeup dt=10
cron_1                        | crond: crond (busybox 1.30.1) started, log level 0
cron_1                        | crond: user:www-data entry:(null)
cron_1                        | 100001000010000100001000010000100001000010000100001000010000
cron_1                        | 111111111111111111111111
cron_1                        | 11111111111111111111111111111111
cron_1                        | 111111111111
cron_1                        | 1111111
cron_1                        | crond: user:www-data entry:(null)
cron_1                        | 100001000010000100001000010000100001000010000100001000010000
cron_1                        | 111111111111111111111111
cron_1                        | 11111111111111111111111111111111
cron_1                        | 111111111111
cron_1                        | 1111111
cron_1                        | crond: wakeup dt=37
cron_1                        | crond: file www-data:
cron_1                        | crond:  line php -f /var/www/html/cron.php
cron_1                        | crond: wakeup dt=60
cron_1                        | crond: file www-data:
cron_1                        | crond:  line php -f /var/www/html/cron.php
cron_1                        | crond: crond (busybox 1.30.1) started, log level 0
cron_1                        | crond: user:www-data entry:(null)
cron_1                        | 100001000010000100001000010000100001000010000100001000010000
cron_1                        | 111111111111111111111111
cron_1                        | 11111111111111111111111111111111
cron_1                        | 111111111111
cron_1                        | 1111111
cron_1                        | crond: user:www-data entry:(null)
cron_1                        | 100001000010000100001000010000100001000010000100001000010000
cron_1                        | 111111111111111111111111
cron_1                        | 11111111111111111111111111111111
cron_1                        | 111111111111
cron_1                        | 1111111
cron_1                        | crond: wakeup dt=58
cron_1                        | crond: file www-data:
cron_1                        | crond:  line php -f /var/www/html/cron.php
cron_1                        | crond: wakeup dt=60
cron_1                        | crond: file www-data:
cron_1                        | crond:  line php -f /var/www/html/cron.php
cron_1                        | crond:  job: 0 php -f /var/www/html/cron.php
cron_1                        | crond: child running /bin/bash
cron_1                        | crond: USER www-data pid   8 cmd php -f /var/www/html/cron.php
cron_1                        | PHP Notice:  fwrite(): Write of 3333 bytes failed with errno=95 Operation not supported in /var/www/html/lib/private/Log/File.php on line 89
cron_1                        | Exception: Not installed in /var/www/html/lib/base.php:277
cron_1                        | Stack trace:
cron_1                        | #0 /var/www/html/lib/base.php(649): OC::checkInstalled(Object(OC\SystemConfig))
cron_1                        | nextcloud/server#1 /var/www/html/lib/base.php(1087): OC::init()
cron_1                        | nextcloud/server#2 /var/www/html/cron.php(43): require_once('/var/www/html/l...')
cron_1                        | nextcloud/server#3 {main}
cron_1                        | PHP Notice:  fwrite(): Write of 2306 bytes failed with errno=95 Operation not supported in /var/www/html/lib/private/Log/File.php on line 89
cron_1                        | crond: wakeup dt=10

Web server error log

N/A

Nextcloud log (data/nextcloud.log)

Nothing relevant AFAIK.

Browser log

N/A

JMLX42 avatar Jan 06 '22 18:01 JMLX42

I have the same issue.

Halogenek avatar Jan 24 '22 18:01 Halogenek

Ok, I found that if you use the image: nextcloud:apache for cron instead image: nextcloud:23.0.0 it works.

Halogenek avatar Jan 24 '22 18:01 Halogenek

I have somewhat the same issue. I say somewhat because as opposed to this issue, I can't get any error logs or anything (even with the log set up to debug level as instructed by documentation). All I get, for google integration at least, are normal cron logs with no errors whatsoever and still the import for photos won't work (won't actually start importing photos). It'll just delete the job record from the DB, make a request to google (as I can see in the gcp dashboard) and continue like there's no issue. For me this started after a memory allocation issue (not enough memory).

chrisr4g avatar Jun 08 '22 13:06 chrisr4g

Hi @JMLX42 - I'm unable to reproduce the problem you reported unfortunately (or fortunately, depending on how you look at it - hah).

That first error indicates your cron container can't write to your log file (presumably data/nextcloud.log). The second error suggests that when the cron container checked your config file it didn't find an entry for installed that was set to true. Which is certainly weird since both your cron and app containers are (from your provided compose) supposedly using the same underlying volumes.

The main situation where I can think of where this might not have been the case - is if the cron container was ever started without those volumes listed. Unless the container was completely removed and re-added again, the prior configuration may have persisted despite what's in your Compose file (unless until the underlying host went through a full reboot anyway).. That's just a wild guess though.

Note, you can also exec into your cron container as well to test like you did on your app container. That would be informative. I'd also be curious what your config.php contains from within the cron containers perspective. It should be exactly the same as the app server per your Compose file.

You have sort of a weird bind mount setup:

    volumes:
      - /mnt/nextcloud/html:/var/www/html
      - /mnt/nextcloud/custom_apps:/var/www/html/custom_apps
      - /mnt/nextcloud/config:/var/www/html/config
      - /mnt/nextcloud/data:/var/www/html/data

Since custom_apps, config, and data are all contained under /mnt/nextcloud/html already on your host, their specification here isn't serving a purpose.

Normally you'd only have all these separate if either they weren't in the same file hierarchy on your underlying host - e.g.

    volumes:
      - /mnt/nextcloud/html:/var/www/html
      - /home/jmlx/nextcloud/custom_apps:/var/www/html/custom_apps
      - /home/jmlx/nextcloud/config:/var/www/html/config
      - /home/jmlx/nextcloud/data:/var/www/html/data

.... or if you were using named volumes (which is my best explanation why I keep seeing people end up with mount structures like this... if they're taking the named volumes from the examples than converting them to bind mounts without realizing it) - e.g. this is a typical named volume setup if dedicated volumes are desired for each of those mount points:

    volumes:
      - nextcloud-html:/var/www/html
      - nextcloud-custom_apps:/var/www/html/custom_apps
      - nextcloud-config:/var/www/html/config
      - nextcloud-data:/var/www/html/data

joshtrichards avatar Jul 22 '23 17:07 joshtrichards

Closing due to lack of further info.

I would focus on this suggestion:

Note, you can also exec into your cron container as well to test like you did on your app container. That would be informative. I'd also be curious what your config.php contains from within the cron containers perspective. It should be exactly the same as the app server per your Compose file.

Feel free to follow-up at the Nextcloud Help Forum - https://help.nextcloud.com

joshtrichards avatar Nov 03 '23 14:11 joshtrichards