优化系统服务逻辑

This commit is contained in:
GoEdgeLab
2021-01-12 10:56:30 +08:00
parent e84915d9b0
commit 2a5e90caeb
3 changed files with 58 additions and 3 deletions

View File

@@ -14,6 +14,7 @@ import (
"os"
"os/exec"
"runtime"
"time"
)
func init() {
@@ -94,6 +95,12 @@ func (this *SystemServiceManager) setupSystemd(params maps.Map) error {
return err
}
// 启动Service
go func() {
time.Sleep(5 * time.Second)
_ = exec.Command(systemctl, "start", teaconst.SystemdServiceName).Start()
}()
if output == "enabled" {
// 检查文件路径是否变化
data, err := ioutil.ReadFile("/etc/systemd/system/" + teaconst.SystemdServiceName + ".service")