first working version

This commit is contained in:
ston1th 2021-04-09 22:38:03 +02:00
commit 6da132106f
18 changed files with 519 additions and 96 deletions

View file

@ -15,6 +15,18 @@ func NewSystemdManager(service string) *SystemdManager {
return &SystemdManager{service}
}
func (sm *SystemdManager) Status(ctx context.Context) error {
return exec.CommandContext(ctx, systemctl, "status", sm.service).Run()
}
func (sm *SystemdManager) Start(ctx context.Context) error {
return exec.CommandContext(ctx, systemctl, "start", sm.service).Run()
}
func (sm *SystemdManager) Stop(ctx context.Context) error {
return exec.CommandContext(ctx, systemctl, "stop", sm.service).Run()
}
func (sm *SystemdManager) Reload(ctx context.Context) error {
return exec.CommandContext(ctx, systemctl, "reload", sm.service).Run()
}