Cron not behaving correctly (some crons run, but not purging backups and custom crons stuck in 'ready')

I’ve setup cron for my Grav site and cache-clearand default-site-backup are running. However, it does not cleanup old backups. Max retention time is set to 7 days.

purge:
  trigger: time
  max_backups_count: 25
  max_backups_space: 5
  max_backups_time: 7
profiles:
  -
    name: 'Default Site Backup'
    root: /
    exclude_paths: "/backup\n/cache\n/images\n/logs\n/tmp"
    exclude_files: ".DS_Store\n.git\n.svn\n.hg\n.idea\n.vscode\nnode_modules"
    schedule: true
    schedule_at: '0 3 * * *'

The following crons are enabled in /var/www/www.example.com/user/config:

status:
  logrotate-grav: enabled
  delete-email-data: enabled
  cache-purge: enabled
  cache-clear: enabled
  default-site-backup: enabled
custom_jobs:
  logrotate-grav:
    command: /usr/sbin/logrotate
    args: '--verbose --state=/var/www/www.example.com/logrotate.status /var/www/www.example.com/logrotate.d/grav'
    at: '0 1 * * *'
    output: logs/logrotate-grav.log
    output_mode: overwrite
    email: null
  delete-email-data:
    command: /usr/bin/find
    args: '/var/www/www.example.com/user/data/contact/ -mtime +90 -delete -print'
    at: '5 4 * * *'
    output: logs/delete-email-data.log
    output_mode: overwrite
    email: null

However, I also have configs in /var/www/www.example.com/user/www.example.com/config. In there it contains a different config. For example, the 7 day purge is not enabled there. Should I remove that subfolder because it overrides the configs set in the Grav admin panel? For some reason the admin panel does not change those values. I did not create this directory (on purpose).

@AquaL1te, Grav’s Environment Configuration might be at work here…

Once folders like /user/env/www.example.com/config/ or /user/www.example.com/config/ exists, Grav will read the configs from that folder when the site is accessed using the url https://www.example.com. Any config change made in Admin will also be written into those folders.

If you delete the folders, Grav will fallback to /user/config/.

1 Like