Documentation
¶
Index ¶
- func DaemonReload() error
- func NameToServiceFile(name string) string
- func SetServiceStatus(service string, newStatus SystemdCommand) error
- func SystemfileExists(name string) bool
- type Install
- type SService
- type Service
- type ServiceRestart
- type ServiceType
- type SystemdBool
- type SystemdCommand
- type Target
- type Unit
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NameToServiceFile ¶
NameToServiceFile returns the name of the servicefile
func SetServiceStatus ¶
func SetServiceStatus(service string, newStatus SystemdCommand) error
SetServiceStatus sets new status for service
func SystemfileExists ¶
SystemfileExists returns true if service exists
Types ¶
type SService ¶
type SService struct { Type ServiceType ExecStartPre string ExecStart string ExecReload string ExecStop string RestartSec string User string Group string Restart ServiceRestart TimeoutStartSec int TimeoutStopSec int SuccessExitStatus string RestartPreventExitStatus string PIDFile string WorkingDirectory string RootDirectory string EnvironmentFile string RuntimeDirectory string RuntimeDirectoryMode string LogsDirectory string KillMode string ConditionPathExists string RemainAfterExit SystemdBool }
SService Service in .service file
type Service ¶
type Service struct { Name string `name:"name"` Unit Unit `name:"[Unit]"` Service SService `name:"[Service]"` Install Install `name:"[Install]"` }
Service service
func NewDefaultService ¶
NewDefaultService creates a new default service
func NewService ¶
NewService creates a new service
type ServiceRestart ¶
type ServiceRestart string
ServiceRestart when the service should be restarted
const ( //No don't restart No ServiceRestart = "no" //Always restart always Always ServiceRestart = "always" //OnSuccess restart only on success (exitcode=0 or on SIGHUP, SIGINT, SIGTERM or on SIGPIPE) OnSuccess ServiceRestart = "on-success" //OnFailure restart only on failure (exitcode != 0) OnFailure ServiceRestart = "on-failure" //OnAbnormal restart if the service was terminated by a signal, or an operation timed out OnAbnormal ServiceRestart = "on-abnormal" //OnAbort restart if the service was terminated by an non clean exit signal OnAbort ServiceRestart = "on-abort" //OnWatchdog restart if the watchdog timed out OnWatchdog = "on-watchdog" )
type ServiceType ¶
type ServiceType string
ServiceType type of service
const ( //Simple simple service Simple ServiceType = "simple" //Notify tells the systemd if its initialzed Notify ServiceType = "notify" //Forking keep active if a fork is running but the parent has exited Forking ServiceType = "forking" //Dbus a dbus service Dbus ServiceType = "dbus" //Oneshot wait until the start action has finished until it consideres to be active Oneshot ServiceType = "oneshot" //Exec similar to simple Exec ServiceType = "exec" )
type SystemdBool ¶
type SystemdBool string
SystemdBool a bool (true=yes/false=no)
const ( //True true True SystemdBool = "yes" //False false False SystemdBool = "no" )
type SystemdCommand ¶
type SystemdCommand int
SystemdCommand a command for systemd
const ( //Stop stops a running service Stop SystemdCommand = 0 //Start starts a stopped service Start SystemdCommand = 1 //Enable enables a service to auto start Enable SystemdCommand = 2 //Disable disables a service to auto start Disable SystemdCommand = 3 //Restart restarts a service Restart SystemdCommand = 4 )
Click to show internal directories.
Click to hide internal directories.