Change the minimum cron execution time

currently cron is default, being called every 5 minutes. I wanted to increase this time to 15 minutes, for example, but I didn’t find a place where I can change it.

My nextcloud installation is through docker. Cron is also installed in a docker container. Below I will make the compose available. If anyone can help me I would be grateful, thank you!

services:
  cron:
    image: nextcloud:latest
    restart: always
    volumes:
      - /srv/dev-disk-by-uuid-1dc14d40-e814-4aac-8659-13b7bc409e99/brteste/Aplications/Nextcloud/app:/var/www/html
    entrypoint: /cron.sh
    depends_on:
      - db
      - app

  db:
    image: mariadb:11.4
    restart: always
    command: --transaction-isolation=READ-COMMITTED --log-bin=binlog --binlog-format=ROW
    volumes:
      - /srv/dev-disk-by-uuid-4d956ca1-ebeb-43bf-9563-6b4bb934082f/BR-DADOS/Aplications/Nextcloud/db:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=xxxx
      - MYSQL_PASSWORD=xxxx
      - MYSQL_DATABASE=xxxx
      - MYSQL_USER=xxxx
      - MARIADB_AUTO_UPGRADE="1"

  app:
    image: nextcloud:latest
    restart: always
    ports:
      - 8080:80
    links:
      - db
    depends_on:
      - db
    volumes:
      - /srv/dev-disk-by-uuid-1dc14d40-e814-4aac-8659-13b7bc409e99/brteste/Aplications/Nextcloud/app:/var/www/html
    environment:
      - MYSQL_PASSWORD=xxxx
      - MYSQL_DATABASE=xxxx
      - MYSQL_USER=xxxx
      - MYSQL_HOST=xxxx

The cron internal is set in the Dockerfile here.

Couple possibilities come to mind:

  • Mount your own crontab file in place of /var/spool/cron/crontabs/www-data via Docker volumes with the adjusted interval
  • Don’t use the cron container and use your host cron to trigger cron.sh instead via docker compose exec
  • Edit the Dockerfile that and build your own image from it

Out of curiosity, why?

1 Like

Hi, thanks for your reply
My intention first is to try to change the cron interval to see if the use of my hard drives goes down. From what I understand, every 5 minutes when cron is called, the use of hard drives goes to maximum. Note: I have 2TB of data

I was able to change the cron interval using this method. I went into the cron container and changed the www-data file in /var/spool/cron/crontabs/www-data

I configured cron to be called every 15 minutes:

*/15 * * * * php -f /var/www/html/cron.php

Remembering that, if the cron container is recreated, it will be created by default with an interval every 5 minutes, so the file must be changed again

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