|
|
@ -70,6 +70,7 @@ func add() { |
|
|
|
forUser := false |
|
|
|
forSystem := false |
|
|
|
dryrun := false |
|
|
|
pathEnv := "" |
|
|
|
flag.StringVar(&conf.Title, "title", "", "a human-friendly name for the service") |
|
|
|
flag.StringVar(&conf.Desc, "desc", "", "a human-friendly description of the service (ex: Foo App)") |
|
|
|
flag.StringVar(&conf.Name, "name", "", "a computer-friendly name for the service (ex: foo-app)") |
|
|
@ -79,7 +80,7 @@ func add() { |
|
|
|
flag.BoolVar(&forSystem, "system", false, "attempt to add system service as an unprivileged/unelevated user") |
|
|
|
flag.BoolVar(&forUser, "user", false, "add user space / user mode service even when admin/root/sudo/elevated") |
|
|
|
flag.BoolVar(&force, "force", false, "if the interpreter or executable doesn't exist, or things don't make sense, try anyway") |
|
|
|
flag.StringVar(&conf.Path, "path", "", "set the path for the resulting systemd service") |
|
|
|
flag.StringVar(&pathEnv, "path", "", "set the path for the resulting systemd service") |
|
|
|
flag.StringVar(&conf.User, "username", "", "run the service as this user") |
|
|
|
flag.StringVar(&conf.Group, "groupname", "", "run the service as this group") |
|
|
|
flag.BoolVar(&conf.PrivilegedPorts, "cap-net-bind", false, "this service should have access to privileged ports") |
|
|
@ -164,6 +165,10 @@ func add() { |
|
|
|
ass = append(ass, fmt.Sprintf(" --name %s", conf.Name)) |
|
|
|
ass = append(ass, "") |
|
|
|
} |
|
|
|
if "" != pathEnv { |
|
|
|
conf.Envs = make(map[string]string) |
|
|
|
conf.Envs["PATH"] = pathEnv |
|
|
|
} |
|
|
|
|
|
|
|
exepath, err := findExec(flagargs[0], force) |
|
|
|
if nil != err { |
|
|
|