Question about scheduling the first Saturday of January using Cron and date command

Aperta
#571 8 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
go
Ambito
devops

Direzione di ricerca

Start by reading the configuration reference and the code that expands environment variables and schedules cron expressions; the issue names no files or tests. Check whether command substitution or special cron syntax is supported, then document or implement a supported way to run a job on January’s first Saturday. The thread has had no comment for 342 days, so confirm the discussion has a settled direction before starting.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

documentation support

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.

Lingua principale
Go
Stelle
4.1k
Fork
157
Merge medio
4h 35m
PR unite (30g)
15

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di offen/docker-volume-backup

Tutte le issue di offen/docker-volume-backup

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.