23 lines
564 B
Go
23 lines
564 B
Go
package svcctl
|
|
|
|
import (
|
|
"os/exec"
|
|
|
|
"sectorinf.com/emilis/hlctl/config"
|
|
"sectorinf.com/emilis/hlctl/ctllog"
|
|
"sectorinf.com/emilis/hlctl/hlcl"
|
|
)
|
|
|
|
var log = ctllog.Logger{}.New("config", ctllog.ColorRGB{}.FromHex("2e8647"))
|
|
|
|
func RestartServices(cfg config.ServicesConfig) {
|
|
for _, svc := range cfg.Services {
|
|
log.Printf("Restarting [%s]", svc)
|
|
if err := exec.Command("pkill", "-9", svc).Run(); err != nil {
|
|
log.Errorf("Killing [%s]: %s", svc, err)
|
|
}
|
|
if err := hlcl.SilentSpawn(svc); err != nil {
|
|
log.Errorf("Starting [%s]: %s", svc, err)
|
|
}
|
|
}
|
|
} |