Skip to content

Cron syntax being wrongly parsed #402

@leleobhz

Description

@leleobhz

Hello!

I tried to create a scheduler to run at 12h and 23h, but Ofelia is behaving somewhat strange as I expected (Apparently minutes are swapped with hour):

ofelia-1  | 2026-01-12T15:14:34.699-03:00  scheduler.go:44 ▶ NOTICE New job registered "gfix-sweep" - "bash -xc \"/opt/firebird/bin/gfix -sweep -parallel $(nproc --ignore=1) -user SYSDBA -pas ${FIREBIRD_ROOT_PASSWORD} localhost:${FIREBIRD_DATA}/${FIREBIRD_DATABASE}\"" - "0 12,23 * * *"
ofelia-1  | 2026-01-12T15:14:34.7-03:00  scheduler.go:55 ▶ DEBUG Starting scheduler with 1 jobs
ofelia-1  | 2026-01-12T15:23:00.105-03:00  common.go:125 ▶ NOTICE [Job "gfix-sweep" (e310479c47e5)] Started - bash -xc "/opt/firebird/bin/gfix -sweep -parallel $(nproc --ignore=1) -user SYSDBA -pas ${FIREBIRD_ROOT_PASSWORD} localhost:${FIREBIRD_DATA}/${FIREBIRD_DATABASE}"
ofelia-1  | 2026-01-12T15:23:00.627-03:00  common.go:125 ▶ NOTICE [Job "gfix-sweep" (e310479c47e5)] StdErr: ++ nproc --ignore=1
ofelia-1  | + /opt/firebird/bin/gfix -sweep -parallel 11 -user SYSDBA -pas masterkey localhost:/var/lib/firebird/data/DADOS.FDB
ofelia-1  | 2026-01-12T15:23:00.627-03:00  common.go:125 ▶ NOTICE [Job "gfix-sweep" (e310479c47e5)] Finished in "521.649409ms", failed: false, skipped: false, error: none
ofelia-1  | 2026-01-12T16:12:00.16-03:00  common.go:125 ▶ NOTICE [Job "gfix-sweep" (3e36c967df89)] Started - bash -xc "/opt/firebird/bin/gfix -sweep -parallel $(nproc --ignore=1) -user SYSDBA -pas ${FIREBIRD_ROOT_PASSWORD} localhost:${FIREBIRD_DATA}/${FIREBIRD_DATABASE}"
ofelia-1  | 2026-01-12T16:12:00.59-03:00  common.go:125 ▶ NOTICE [Job "gfix-sweep" (3e36c967df89)] StdErr: ++ nproc --ignore=1
ofelia-1  | + /opt/firebird/bin/gfix -sweep -parallel 11 -user SYSDBA -pas masterkey localhost:/var/lib/firebird/data/DADOS.FDB
ofelia-1  | 2026-01-12T16:12:00.591-03:00  common.go:125 ▶ NOTICE [Job "gfix-sweep" (3e36c967df89)] Finished in "430.222364ms", failed: false, skipped: false, error: none
ofelia-1  | 2026-01-12T16:23:00.061-03:00  common.go:125 ▶ NOTICE [Job "gfix-sweep" (7dc991ca8dd7)] Started - bash -xc "/opt/firebird/bin/gfix -sweep -parallel $(nproc --ignore=1) -user SYSDBA -pas ${FIREBIRD_ROOT_PASSWORD} localhost:${FIREBIRD_DATA}/${FIREBIRD_DATABASE}"
ofelia-1  | 2026-01-12T16:23:00.504-03:00  common.go:125 ▶ NOTICE [Job "gfix-sweep" (7dc991ca8dd7)] StdErr: ++ nproc --ignore=1
ofelia-1  | + /opt/firebird/bin/gfix -sweep -parallel 11 -user SYSDBA -pas masterkey localhost:/var/lib/firebird/data/DADOS.FDB
ofelia-1  | 2026-01-12T16:23:00.504-03:00  common.go:125 ▶ NOTICE [Job "gfix-sweep" (7dc991ca8dd7)] Finished in "443.408811ms", failed: false, skipped: false, error: none
ofelia-1  | 2026-01-12T17:12:00.064-03:00  common.go:125 ▶ NOTICE [Job "gfix-sweep" (09a168d41f23)] Started - bash -xc "/opt/firebird/bin/gfix -sweep -parallel $(nproc --ignore=1) -user SYSDBA -pas ${FIREBIRD_ROOT_PASSWORD} localhost:${FIREBIRD_DATA}/${FIREBIRD_DATABASE}"
ofelia-1  | 2026-01-12T17:12:00.511-03:00  common.go:125 ▶ NOTICE [Job "gfix-sweep" (09a168d41f23)] StdErr: ++ nproc --ignore=1
ofelia-1  | + /opt/firebird/bin/gfix -sweep -parallel 11 -user SYSDBA -pas masterkey localhost:/var/lib/firebird/data/DADOS.FDB
ofelia-1  | 2026-01-12T17:12:00.511-03:00  common.go:125 ▶ NOTICE [Job "gfix-sweep" (09a168d41f23)] Finished in "447.09651ms", failed: false, skipped: false, error: none
ofelia-1  | 2026-01-12T17:23:00.058-03:00  common.go:125 ▶ NOTICE [Job "gfix-sweep" (b6f5ff32e13f)] Started - bash -xc "/opt/firebird/bin/gfix -sweep -parallel $(nproc --ignore=1) -user SYSDBA -pas ${FIREBIRD_ROOT_PASSWORD} localhost:${FIREBIRD_DATA}/${FIREBIRD_DATABASE}"
ofelia-1  | 2026-01-12T17:23:00.519-03:00  common.go:125 ▶ NOTICE [Job "gfix-sweep" (b6f5ff32e13f)] StdErr: ++ nproc --ignore=1
ofelia-1  | + /opt/firebird/bin/gfix -sweep -parallel 11 -user SYSDBA -pas masterkey localhost:/var/lib/firebird/data/DADOS.FDB
ofelia-1  | 2026-01-12T17:23:00.52-03:00  common.go:125 ▶ NOTICE [Job "gfix-sweep" (b6f5ff32e13f)] Finished in "461.210201ms", failed: false, skipped: false, error: none
ofelia-1  | 2026-01-12T18:12:00.06-03:00  common.go:125 ▶ NOTICE [Job "gfix-sweep" (84fee6e5c959)] Started - bash -xc "/opt/firebird/bin/gfix -sweep -parallel $(nproc --ignore=1) -user SYSDBA -pas ${FIREBIRD_ROOT_PASSWORD} localhost:${FIREBIRD_DATA}/${FIREBIRD_DATABASE}"
ofelia-1  | 2026-01-12T18:12:00.563-03:00  common.go:125 ▶ NOTICE [Job "gfix-sweep" (84fee6e5c959)] StdErr: ++ nproc --ignore=1
ofelia-1  | + /opt/firebird/bin/gfix -sweep -parallel 11 -user SYSDBA -pas masterkey localhost:/var/lib/firebird/data/DADOS.FDB
ofelia-1  | 2026-01-12T18:12:00.563-03:00  common.go:125 ▶ NOTICE [Job "gfix-sweep" (84fee6e5c959)] Finished in "502.346513ms", failed: false, skipped: false, error: none
ofelia-1  | 2026-01-12T18:23:00.06-03:00  common.go:125 ▶ NOTICE [Job "gfix-sweep" (d050f15f2f18)] Started - bash -xc "/opt/firebird/bin/gfix -sweep -parallel $(nproc --ignore=1) -user SYSDBA -pas ${FIREBIRD_ROOT_PASSWORD} localhost:${FIREBIRD_DATA}/${FIREBIRD_DATABASE}"
ofelia-1  | 2026-01-12T18:23:00.495-03:00  common.go:125 ▶ NOTICE [Job "gfix-sweep" (d050f15f2f18)] StdErr: ++ nproc --ignore=1
ofelia-1  | + /opt/firebird/bin/gfix -sweep -parallel 11 -user SYSDBA -pas masterkey localhost:/var/lib/firebird/data/DADOS.FDB
ofelia-1  | 2026-01-12T18:23:00.495-03:00  common.go:125 ▶ NOTICE [Job "gfix-sweep" (d050f15f2f18)] Finished in "434.982824ms", failed: false, skipped: false, error: none

As far I understood, "0 23,12 * * *" matches the idea of https://github.com/mcuadros/ofelia/blob/master/core/scheduler.go#L35 but ofelia:latest run on 0.3.20, that does not have the custom object ( https://github.com/mcuadros/ofelia/blob/v0.3.20/core/scheduler.go#L29 ).

This is an issue or I just misundersood the way to proper set the cron?

Also, using ofelia:latest image.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions