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:
@@ -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{}
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ type Task interface {
|
||||
UserGroup() UserGroup
|
||||
WorkingDir() string
|
||||
Status() TaskStatus
|
||||
UtilDepCheck() error
|
||||
}
|
||||
|
||||
type CronTask interface {
|
||||
|
||||
@@ -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{}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user