resticprofile icon indicating copy to clipboard operation
resticprofile copied to clipboard

Schedule on first monday every month doesn't work with crond

Open FH3095 opened this issue 10 months ago • 1 comments

Hello,

I tried to schedule a backup-run for every first Monday in a month. I configured the scheduler to crond and used the following schedule-line:

[default.backup]
schedule = "Mon *-*-1..7 05:30:00"
source = [ "/mnt/backup/data/" ]

That results in the following cron-line: 30 05 01-07 * 1 cd /mnt/backup/restic && /mnt/backup/restic/resticprofile --no-ansi --config profiles.toml run-schedule backup@default

But this doesn't work with crond. According to man 5 crontab:

Note: The day of a command's execution can be specified by two fields - day of month, and day of week. If both fields are restricted (ie, aren't *), the command will be run when either field matches the current time. For example, "30 4 1,15 * 5" would cause a command to be run at 4:30 am on the 1st and 15th of each month, plus every Friday.

So my command would run every Monday and additionally every month for the first seven days. The generated cron-line should instead look something like this: 30 05 01-07 * * test $(date '+\%u') -eq 1 && cd /mnt/backup/restic && [...]

FH3095 avatar Apr 07 '25 16:04 FH3095

Thanks for the detailed report, this is definitely a bug 😢

creativeprojects avatar Apr 07 '25 18:04 creativeprojects