fix(splitargs): wrong code, check should be outside of loop

feat(config): added WMPidProxyCheckVersion and WMExecCheckVersion to the interface; mutex for accessing viper
fixed(docker/bookworm-newconfig): golang version and config path
feat(UtilDepCheck): added utility dependency check before running the task
This commit is contained in:
2024-03-27 23:04:30 +11:00
parent a63646aab2
commit 7db6f6f8f3
13 changed files with 295 additions and 40 deletions

View File

@@ -29,6 +29,10 @@ cron:
for {
if cron.TimeToRun(time.Now()) {
wingmate.Log().Info().Str(cronTag, cron.Name()).Msg("executing")
if err = cron.UtilDepCheck(); err != nil {
wingmate.Log().Error().Str(cronTag, cron.Name()).Msgf("%+v", err)
goto fail
}
cmd = exec.Command(cron.Command(), cron.Arguments()...)
iwg = &sync.WaitGroup{}

View File

@@ -30,6 +30,7 @@ type Task interface {
UserGroup() UserGroup
WorkingDir() string
Status() TaskStatus
UtilDepCheck() error
}
type CronTask interface {

View File

@@ -33,6 +33,11 @@ func (i *Init) service(wg *sync.WaitGroup, task ServiceTask, exitFlag <-chan any
service:
for {
failStatus = false
if err = task.UtilDepCheck(); err != nil {
wingmate.Log().Error().Str(serviceTag, task.Name()).Msgf("%+v", err)
failStatus = true
goto fail
}
cmd = exec.Command(task.Command(), task.Arguments()...)
iwg = &sync.WaitGroup{}