feat: reload config for the execution

This commit is contained in:
kekskurse 2025-07-31 03:33:40 +02:00
parent ad19c98615
commit 416b478237

12
main.go
View file

@ -2,7 +2,6 @@ package main
import ( import (
"bytes" "bytes"
"fmt"
"os/exec" "os/exec"
"syscall" "syscall"
"time" "time"
@ -29,10 +28,13 @@ func main() {
for { for {
select { select {
case t := <-cronTicker: case t := <-cronTicker:
fmt.Println("Tick bei Sekunde 0:", t.Format(time.RFC3339Nano))
execucteJobs(t, currentConfig.Jobs) execucteJobs(t, currentConfig.Jobs)
case t := <-configTicker: case <-configTicker:
fmt.Println("Tick bei Sekunde 50:", t.Format(time.RFC3339Nano)) log.Debug().Msg("Reload Config")
currentConfig, err = ReadFromFile("config.yml")
if err != nil {
log.Error().Err(err).Msg("cant read config")
}
} }
} }
} }
@ -48,7 +50,7 @@ func execucteJobs(t time.Time, jobs []jobconfig) {
continue continue
} }
_ = executeCommand(job) go executeCommand(job)
} }
} }