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 (
"bytes"
"fmt"
"os/exec"
"syscall"
"time"
@ -29,10 +28,13 @@ func main() {
for {
select {
case t := <-cronTicker:
fmt.Println("Tick bei Sekunde 0:", t.Format(time.RFC3339Nano))
execucteJobs(t, currentConfig.Jobs)
case t := <-configTicker:
fmt.Println("Tick bei Sekunde 50:", t.Format(time.RFC3339Nano))
case <-configTicker:
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
}
_ = executeCommand(job)
go executeCommand(job)
}
}