wip: created example files with new config and implementing new config in init

This commit is contained in:
2024-03-24 13:24:47 +11:00
parent 6032b6c0c1
commit 8f68c4ace9
12 changed files with 108 additions and 28 deletions

View File

@@ -29,11 +29,7 @@ cron:
for {
if cron.TimeToRun(time.Now()) {
wingmate.Log().Info().Str(cronTag, cron.Name()).Msg("executing")
if len(cron.Command()) == 1 {
cmd = exec.Command(cron.Command()[0])
} else {
cmd = exec.Command(cron.Command()[0], cron.Command()[1:]...)
}
cmd = exec.Command(cron.Command(), cron.Arguments()...)
iwg = &sync.WaitGroup{}
if stdout, err = cmd.StdoutPipe(); err != nil {

View File

@@ -23,7 +23,8 @@ type TaskStatus interface {
type Task interface {
Name() string
Command() []string
Command() string
Arguments() []string
Environ() []string
Setsid() bool
UserGroup() UserGroup
@@ -47,6 +48,8 @@ type ServiceTask interface {
type Config interface {
Tasks() Tasks
WMPidProxyPath() string
WMExecPath() string
}
type Init struct {

View File

@@ -33,11 +33,7 @@ func (i *Init) service(wg *sync.WaitGroup, task ServiceTask, exitFlag <-chan any
service:
for {
failStatus = false
if len(task.Command()) == 1 {
cmd = exec.Command(task.Command()[0])
} else {
cmd = exec.Command(task.Command()[0], task.Command()[1:]...)
}
cmd = exec.Command(task.Command(), task.Arguments()...)
iwg = &sync.WaitGroup{}
if stdout, err = cmd.StdoutPipe(); err != nil {