Documentation
¶
Index ¶
Constants ¶
const ( SystemdScopeSystem = "system" SystemdScopeUser = "user" SystemdScopeGlobal = "global" )
scope can be either "system", "user" or "global"
const ( // UserActionAdd add user. UserActionAdd = "add" // UserActionDel delete user. UserActionDel = "del" )
Variables ¶
var ( // ErrUserAddFailed is ErrUserAddFailed ErrUserAddFailed = errNSUser.NewType("user_add_failed") // ErrUserDeleteFailed is ErrUserDeleteFailed ErrUserDeleteFailed = errNSUser.NewType("user_delete_failed") )
Functions ¶
This section is empty.
Types ¶
type ShellModule ¶
type ShellModule struct {
// contains filtered or unexported fields
}
ShellModule is the module used to control systemd units
func NewShellModule ¶
func NewShellModule(config ShellModuleConfig) *ShellModule
NewShellModule builds and returns a ShellModule object base on given config.
type ShellModuleConfig ¶
type ShellModuleConfig struct { Command string // the command to run Sudo bool // whether use root privilege to run the command Chdir string // change working directory before running the command UseShell bool // whether use shell to invoke the command }
ShellModuleConfig is the configurations used to initialize a TiUPModuleSystemd
type SystemdModule ¶
type SystemdModule struct {
// contains filtered or unexported fields
}
SystemdModule is the module used to control systemd units
func NewSystemdModule ¶
func NewSystemdModule(config SystemdModuleConfig) *SystemdModule
NewSystemdModule builds and returns a SystemdModule object base on given config.
type SystemdModuleConfig ¶
type SystemdModuleConfig struct { Unit string // the name of systemd unit(s) Action string // the action to perform with the unit ReloadDaemon bool // run daemon-reload before other actions CheckActive bool // run is-active before action Scope string // user, system or global Force bool // add the `--force` arg to systemctl command Signal string // specify the signal to send to process Timeout time.Duration // timeout to execute the command }
SystemdModuleConfig is the configurations used to initialize a SystemdModule
type UserModule ¶
type UserModule struct {
// contains filtered or unexported fields
}
UserModule is the module used to control systemd units
func NewUserModule ¶
func NewUserModule(config UserModuleConfig) *UserModule
NewUserModule builds and returns a UserModule object base on given config.
type UserModuleConfig ¶
type UserModuleConfig struct { Action string // add, del or modify user Name string // username Group string // group name Home string // home directory of user Shell string // login shell of the user Sudoer bool // when true, the user will be added to sudoers list }
UserModuleConfig is the configurations used to initialize a UserModule
type WaitFor ¶
type WaitFor struct {
// contains filtered or unexported fields
}
WaitFor is the module used to wait for some condition.
type WaitForConfig ¶
type WaitForConfig struct { Port int // Port number to poll. Sleep time.Duration // Duration to sleep between checks, default 1 second. // Choices: // started // stopped // When checking a port started will ensure the port is open, stopped will check that it is closed State string Timeout time.Duration // Maximum duration to wait for. }
WaitForConfig is the configurations of WaitFor module.