feat: reload config for the execution
This commit is contained in:
parent
ad19c98615
commit
416b478237
1 changed files with 7 additions and 5 deletions
12
main.go
12
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)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue