-
-
Notifications
You must be signed in to change notification settings - Fork 117
Description
What are you trying to do?
I am trying to schedule a Cron job that runs specifically on the first Saturday of January at midnight. I noticed that the Cron expression 0 0 1 ? 1 SAT#1 *
can achieve this, but according to the configuration reference it has not allowed special characters.
Likewise, I want to know if a similar approach using standard cron syntax and the date
command is supported.
What is your current configuration?
Here is the Cron expression I am considering:
# run every Saturday in January at midnight, check if it's the first Saturday
BACKUP_CRON_EXPRESSION="0 0 * 1 6 [ "$(date +\%d)" -le 7 ]"
Log output
time=2025-04-05T17:35:13.058+02:00 level=ERROR msg="Fatal error running command: unexpected command substitution at 1:38" error="main.(*command).runInForeground: error scheduling: main.(*command).schedule: error sourcing configuration: main.sourceConfiguration: error loading config files: main.loadConfigsFromEnvFiles: error reading config file /etc/dockervolumebackup/conf.d/04yearly.conf: main.source: error expanding env: unexpected command substitution at 1:38"
Additional context
I would like to confirm if this approach is valid in your Cron implementation. If it is not supported, could you recommend an alternative method to schedule a job for the first Saturday of January? Any guidance or examples would be greatly appreciated.