优化systemd服务配置

This commit is contained in:
刘祥超
2024-03-08 18:56:08 +08:00
parent 94aefacba4
commit 6d8be979db

View File

@@ -115,6 +115,12 @@ func (this *ServiceManager) installSystemdService(systemd, exePath string, args
var shortName = teaconst.SystemdServiceName
var longName = "GoEdge Node" // TODO 将来可以修改
var startCmd = exePath + " daemon"
bashPath, _ := executils.LookPath("bash")
if len(bashPath) > 0 {
startCmd = bashPath + " -c \"" + startCmd + "\""
}
var desc = `### BEGIN INIT INFO
# Provides: ` + shortName + `
# Required-Start: $all
@@ -133,7 +139,7 @@ After=network-online.target
Type=simple
Restart=always
RestartSec=1s
ExecStart=` + exePath + ` daemon
ExecStart=` + startCmd + `
ExecStop=` + exePath + ` stop
ExecReload=` + exePath + ` reload