Documentation
¶
Overview ¶
Package systemd uses the native systemctl/journalctl commands to interact with the systemd and journald services.
Index ¶
Constants ¶
View Source
const ( Emergency = Priority("0") Alert = Priority("1") Critical = Priority("2") Error = Priority("3") Warning = Priority("4") Notice = Priority("5") Informational = Priority("6") Debug = Priority("7") )
Priority levels
View Source
const ( // Enabled is a state reported by systemctl Enabled = UnitFileState("enabled") // Disabled is a state reported by systemctl Disabled = UnitFileState("disabled") // Active is a state reported by systemctl Active = ActiveState("active") // Inactive is a state reported by systemctl Inactive = ActiveState("inactive") // Running is a substate reported by systemctl Running = SubState("running") // Dead is a substate reported by systemctl Dead = SubState("dead") )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Entry ¶
type Entry struct { Cursor string `json:"__CURSOR"` // The __CURSOR field Timestamp int64 `json:"__REALTIME_TIMESTAMP,string"` // The __REALTIME__TIMESTAMP field (microseconds since epoch) Message string `json:"-"` // The string representation of the message source. MessageSource interface{} `json:"MESSAGE"` // The MESSAGE field. This might be an array of bytes *or* a string Unit string `json:"_SYSTEMD_UNIT"` // The _SYSTEMD_UNIT field Priority Priority `json:"PRIORITY"` // The PRIORITY field UnitResult string `json:"UNIT_RESULT"` // The UNIT_RESULT field. This is set if the service has terminated for some reason. It is empty otherwise Valid bool `json:"-"` // Valid JSON when decoding SourceData string `json:"-"` // The source JSON. This might be invalid. }
Entry is a single entry from journald
type Journalctl ¶
type Journalctl interface { // Entries returns the last entry in the journal. If there is no entries // an empty entry will be returned LastEntry(unit string) (Entry, error) // EntriesAfter returns entries after the specified cursor position. The // newest entry is returned first. If the cursor parameter is empty the // last 100 entries are returned. EntriesAfter(unit string, cursor string) ([]Entry, error) }
Journalctl interacts with the native journalctl installation to pull logs from the systemd-journald
type Systemctl ¶
type Systemctl interface { // State returns unit file, active and substate for the unit. State(unitName string) (UnitFileState, ActiveState, SubState, error) // Restart call systemctl restart <unit> -- if there's an error the exit // code will hint at what the issue is (see systemctl(1) man page for exit codes) Restart(unitName string) error // Stop stops the unit Stop(unitName string) error }
Systemctl interacts with the native systemcl command
Click to show internal directories.
Click to hide internal directories.