wip: feat(task): added missing information and rearrange

This commit is contained in:
Suyono 2024-01-11 11:56:18 +11:00
parent 6a68209629
commit cdc66a2c22
3 changed files with 13 additions and 6 deletions

View File

@ -25,7 +25,6 @@ type Task interface {
Environ() []string Environ() []string
Setsid() bool Setsid() bool
UserGroup() UserGroup UserGroup() UserGroup
Background() bool //NOTE: implies using wmpidproxy
WorkingDir() string WorkingDir() string
Status() TaskStatus Status() TaskStatus
} }
@ -37,6 +36,8 @@ type CronTask interface {
type ServiceTask interface { type ServiceTask interface {
Task Task
Background() bool //NOTE: implies using wmpidproxy
StartSecs() uint
AutoStart() bool AutoStart() bool
AutoRestart() bool AutoRestart() bool
} }

View File

@ -148,11 +148,6 @@ func (c *CronTask) UserGroup() wminit.UserGroup {
return nil return nil
} }
func (c *CronTask) Background() bool {
//NOTE: cron will always return false for this
return false
}
func (c *CronTask) WorkingDir() string { func (c *CronTask) WorkingDir() string {
panic("not implemented") panic("not implemented")
return "" return ""

View File

@ -67,6 +67,7 @@ type ServiceTask struct {
group string group string
background bool background bool
workingDir string workingDir string
startSecs uint
} }
func NewServiceTask(name string) *ServiceTask { func NewServiceTask(name string) *ServiceTask {
@ -112,6 +113,11 @@ func (t *ServiceTask) SetGroup(group string) *ServiceTask {
return t return t
} }
func (t *ServiceTask) SetStartSecs(secs uint) *ServiceTask {
t.startSecs = secs
return t
}
func (t *ServiceTask) Name() string { func (t *ServiceTask) Name() string {
return t.name return t.name
} }
@ -161,3 +167,8 @@ func (t *ServiceTask) AutoRestart() bool {
panic("not implemented") panic("not implemented")
return false return false
} }
func (t *ServiceTask) StartSecs() uint {
panic("not implemented")
return 0
}