reboot

package
v0.4.4-rc.0 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package reboot provides a function to reboot the system.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotRoot = errors.New("must be run as sudo/root")

Functions

func LastReboot added in v0.4.3

func LastReboot(ctx context.Context) (time.Time, error)

func LastRebootHelper added in v0.4.3

func LastRebootHelper(lines [][]byte) (time.Time, error)

LastRebootHelper parses the last reboot time from the output of "uptime -s".

func Reboot

func Reboot(ctx context.Context, opts ...OpOption) error

Reboots the system.

Types

type Op

type Op struct {
	// contains filtered or unexported fields
}

type OpOption

type OpOption func(*Op)

func WithDelaySeconds added in v0.0.5

func WithDelaySeconds(delaySeconds int) OpOption

Specifies the delay seconds before rebooting. Useful for the remote server to get the response from a GPUd daemon.

func WithSystemctl

func WithSystemctl(b bool) OpOption

Set true to run "systemctl reboot".

Jump to

Keyboard shortcuts

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