service: add minor docs addition and error messages.
This commit is contained in:
@@ -9,20 +9,6 @@ It also can be used to detect how a program is called, from an interactive
|
||||
terminal or from a service manager.
|
||||
|
||||
## TODO
|
||||
Need to test the Interactive test for the following platforms:
|
||||
* systemd system and user service
|
||||
* Launchd system and user service
|
||||
|
||||
The following items need to be done:
|
||||
* Determine if systemd has a launchd equivalent user service.
|
||||
* Fix Interactive test for user services.
|
||||
* Document that windows doesn't have a user service.
|
||||
* Document that upstart's user service definition changes over versions. Do not support.
|
||||
* For Linux platforms and Launchd add:
|
||||
- UserName
|
||||
- Arguments
|
||||
- WorkingDirectory
|
||||
- ChRoot
|
||||
* Determine the best way to document the Config.Option values per platform.
|
||||
- Should some of the current parameters like "ChRoot" and "WorkingDirectory" move to "Option" map?
|
||||
|
||||
* OS X when running as a UserService Interactive will not be accurate.
|
||||
* Determine if UserService should remain in main configuration.
|
||||
* Hook up Dependencies field for Linux systems and Launchd.
|
||||
|
||||
+12
-6
@@ -75,18 +75,24 @@ type Config struct {
|
||||
DisplayName string // Display name, spaces allowed.
|
||||
Description string // Long description of service.
|
||||
Dependencies []string // Array of service dependencies.
|
||||
|
||||
UserName string // Run as username.
|
||||
Arguments []string // Run with arguments.
|
||||
UserName string // Run as username.
|
||||
Arguments []string // Run with arguments.
|
||||
|
||||
// Optional field to specify the executable for service.
|
||||
// If empty the current executable is used.
|
||||
Executable string
|
||||
WorkingDirectory string // Service working directory.
|
||||
Executable string
|
||||
|
||||
// The following fields are not supported on Windows.
|
||||
WorkingDirectory string // Initial working directory.
|
||||
ChRoot string
|
||||
UserService bool // Install as a current user service.
|
||||
|
||||
// Install as a current user service. Only supported on OS X.
|
||||
UserService bool
|
||||
|
||||
// System specific options.
|
||||
// * OS X
|
||||
// - KeepAlive bool (true)
|
||||
// - RunAtLoad bool (false)
|
||||
Option KeyValue
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"os/signal"
|
||||
"text/template"
|
||||
"time"
|
||||
@@ -128,11 +127,11 @@ func (s *upstart) Run() (err error) {
|
||||
}
|
||||
|
||||
func (s *upstart) Start() error {
|
||||
return exec.Command("initctl", "start", s.Name).Run()
|
||||
return run("initctl", "start", s.Name)
|
||||
}
|
||||
|
||||
func (s *upstart) Stop() error {
|
||||
return exec.Command("initctl", "stop", s.Name).Run()
|
||||
return run("initctl", "stop", s.Name)
|
||||
}
|
||||
|
||||
func (s *upstart) Restart() error {
|
||||
|
||||
Reference in New Issue
Block a user