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.
|
terminal or from a service manager.
|
||||||
|
|
||||||
## TODO
|
## TODO
|
||||||
Need to test the Interactive test for the following platforms:
|
* OS X when running as a UserService Interactive will not be accurate.
|
||||||
* systemd system and user service
|
* Determine if UserService should remain in main configuration.
|
||||||
* Launchd system and user service
|
* Hook up Dependencies field for Linux systems and Launchd.
|
||||||
|
|
||||||
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?
|
|
||||||
|
|
||||||
|
|||||||
+12
-6
@@ -75,18 +75,24 @@ type Config struct {
|
|||||||
DisplayName string // Display name, spaces allowed.
|
DisplayName string // Display name, spaces allowed.
|
||||||
Description string // Long description of service.
|
Description string // Long description of service.
|
||||||
Dependencies []string // Array of service dependencies.
|
Dependencies []string // Array of service dependencies.
|
||||||
|
UserName string // Run as username.
|
||||||
UserName string // Run as username.
|
Arguments []string // Run with arguments.
|
||||||
Arguments []string // Run with arguments.
|
|
||||||
|
|
||||||
// Optional field to specify the executable for service.
|
// Optional field to specify the executable for service.
|
||||||
// If empty the current executable is used.
|
// If empty the current executable is used.
|
||||||
Executable string
|
Executable string
|
||||||
WorkingDirectory string // Service working directory.
|
|
||||||
|
// The following fields are not supported on Windows.
|
||||||
|
WorkingDirectory string // Initial working directory.
|
||||||
ChRoot string
|
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.
|
// System specific options.
|
||||||
|
// * OS X
|
||||||
|
// - KeepAlive bool (true)
|
||||||
|
// - RunAtLoad bool (false)
|
||||||
Option KeyValue
|
Option KeyValue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"text/template"
|
"text/template"
|
||||||
"time"
|
"time"
|
||||||
@@ -128,11 +127,11 @@ func (s *upstart) Run() (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *upstart) Start() 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 {
|
func (s *upstart) Stop() error {
|
||||||
return exec.Command("initctl", "stop", s.Name).Run()
|
return run("initctl", "stop", s.Name)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *upstart) Restart() error {
|
func (s *upstart) Restart() error {
|
||||||
|
|||||||
Reference in New Issue
Block a user