systemctl

package
v3.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 25, 2026 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DaemonReload

func DaemonReload() error

DaemonReload 重载 systemd 服务配置

func Disable

func Disable(name string) error

Disable 禁用服务

func Enable

func Enable(name string) error

Enable 启用服务

func IsEnabled

func IsEnabled(name string) (bool, error)

IsEnabled 服务是否启用

func Log

func Log(name string) (string, error)

Log 获取服务日志

func LogClear

func LogClear(name string) error

LogClear 清空服务日志

func LogTail

func LogTail(name string, lines int) (string, error)

LogTail 获取服务日志

func Mask

func Mask(name string) error

Mask 屏蔽服务

func Reload

func Reload(name string) error

Reload 重载服务

func Restart

func Restart(name string) error

Restart 重启服务

func Start

func Start(name string) error

Start 启动服务

func Status

func Status(name string) (bool, error)

Status 获取服务状态

func Stop

func Stop(name string) error

Stop 停止服务

func Unmask

func Unmask(name string) error

Unmask 解除屏蔽服务

Types

type ServiceInfo

type ServiceInfo struct {
	Status string  // 运行状态 (active, inactive, failed, etc.)
	PID    int     // 主进程 PID
	Memory int64   // 内存使用(字节)
	CPU    float64 // CPU 使用率
	Uptime string  // 运行时间
}

ServiceInfo 服务详细信息

func GetServiceInfo

func GetServiceInfo(name string) (*ServiceInfo, error)

GetServiceInfo 获取服务详细信息

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL