MCPcopy
hub / github.com/basecamp/once / systemctl

Method systemctl

internal/service/systemd.go:80–88  ·  view source on GitHub ↗
(ctx context.Context, args ...string)

Source from the content-addressed store, hash-verified

78}
79
80func (s *Systemd) systemctl(ctx context.Context, args ...string) error {
81 cmd := exec.CommandContext(ctx, "systemctl", args...)
82 cmd.Stdout = os.Stdout
83 cmd.Stderr = os.Stderr
84 if err := cmd.Run(); err != nil {
85 return fmt.Errorf("systemctl %s: %w", args[0], err)
86 }
87 return nil
88}
89
90func (s *Systemd) unitFilePath(name string) string {
91 return filepath.Join(systemdUnitDir, name+".service")

Callers 3

InstallMethod · 0.95
RemoveMethod · 0.95
daemonReloadMethod · 0.95

Calls 1

RunMethod · 0.45

Tested by

no test coverage detected