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
Setsid() bool
UserGroup() UserGroup
Background() bool //NOTE: implies using wmpidproxy
WorkingDir() string
Status() TaskStatus
}
@ -37,6 +36,8 @@ type CronTask interface {
type ServiceTask interface {
Task
Background() bool //NOTE: implies using wmpidproxy
StartSecs() uint
AutoStart() bool
AutoRestart() bool
}

View File

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

View File

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