From 416b478237c6c74337a57b5472faa3351a6ca757 Mon Sep 17 00:00:00 2001 From: kekskurse Date: Thu, 31 Jul 2025 03:33:40 +0200 Subject: [PATCH] feat: reload config for the execution --- main.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/main.go b/main.go index aba854a..afa4da4 100644 --- a/main.go +++ b/main.go @@ -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) } }