mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2026-04-01 10:28:57 +08:00
优化系统服务逻辑
This commit is contained in:
@@ -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")
|
||||
|
||||
@@ -126,10 +126,10 @@ Before=shutdown.target
|
||||
After=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
Type=simple
|
||||
Restart=always
|
||||
RestartSec=1s
|
||||
ExecStart=` + exePath + ` start
|
||||
ExecStart=` + exePath + ` daemon
|
||||
ExecStop=` + exePath + ` stop
|
||||
ExecReload=` + exePath + ` reload
|
||||
|
||||
|
||||
Reference in New Issue
Block a user