wip: feat(task): defined concrete type for user group
wip: feat(version): added placeholder file + update gitignore wip: chore: removed unnecessary files
This commit is contained in:
@@ -68,12 +68,11 @@ func (cms *CronMultiOccurrenceSpec) Match(u uint8) bool {
|
||||
|
||||
type CronTask struct {
|
||||
CronSchedule
|
||||
userGroup
|
||||
name string
|
||||
command []string
|
||||
environ []string
|
||||
setsid bool
|
||||
user string
|
||||
group string
|
||||
workingDir string
|
||||
lastRun time.Time
|
||||
hasRun bool //NOTE: make sure initialised as false
|
||||
@@ -144,8 +143,7 @@ func (c *CronTask) Setsid() bool {
|
||||
}
|
||||
|
||||
func (c *CronTask) UserGroup() wminit.UserGroup {
|
||||
panic("not implemented")
|
||||
return nil
|
||||
return &(c.userGroup)
|
||||
}
|
||||
|
||||
func (c *CronTask) WorkingDir() string {
|
||||
|
||||
29
task/task.go
29
task/task.go
@@ -1,6 +1,7 @@
|
||||
package task
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
wminit "gitea.suyono.dev/suyono/wingmate/init"
|
||||
)
|
||||
|
||||
@@ -63,11 +64,10 @@ type ServiceTask struct {
|
||||
command []string
|
||||
environ []string
|
||||
setsid bool
|
||||
user string
|
||||
group string
|
||||
background bool
|
||||
workingDir string
|
||||
startSecs uint
|
||||
userGroup
|
||||
}
|
||||
|
||||
func NewServiceTask(name string) *ServiceTask {
|
||||
@@ -139,8 +139,7 @@ func (t *ServiceTask) Setsid() bool {
|
||||
}
|
||||
|
||||
func (t *ServiceTask) UserGroup() wminit.UserGroup {
|
||||
panic("not implemented")
|
||||
return nil
|
||||
return &(t.userGroup)
|
||||
}
|
||||
|
||||
func (t *ServiceTask) Background() bool {
|
||||
@@ -172,3 +171,25 @@ func (t *ServiceTask) StartSecs() uint {
|
||||
panic("not implemented")
|
||||
return 0
|
||||
}
|
||||
|
||||
func (t *ServiceTask) PidFile() string {
|
||||
panic("not implemented")
|
||||
return ""
|
||||
}
|
||||
|
||||
type userGroup struct {
|
||||
user string
|
||||
group string
|
||||
}
|
||||
|
||||
func (ug *userGroup) IsSet() bool {
|
||||
return len(ug.user) > 0 || len(ug.group) > 0
|
||||
}
|
||||
|
||||
func (ug *userGroup) String() string {
|
||||
if len(ug.group) > 0 {
|
||||
return fmt.Sprintf("%s:%s", ug.user, ug.group)
|
||||
}
|
||||
|
||||
return ug.user
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user