Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Support

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

Solved by pamtbaau View solution

Started by AquaL1te 3 years ago · 1 replies · 540 views
3 years ago

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.

YAML
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:

YAML
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).

last edited 10/12/23 by AquaL1te
3 years ago Solution

@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

Suggested topics

Topic Participants Replies Views Activity
Support · by Thomas, 1 week ago
2 52 8 hours ago
Support · by Anna, 3 days ago
2 59 11 hours ago
Support · by Justin Young, 12 hours ago
1 30 12 hours ago
Support · by Duc , 1 week ago
2 65 5 days ago
Support · by Colin Hume, 1 week ago
2 56 5 days ago