diff --git a/internal/utils/service_linux.go b/internal/utils/service_linux.go index d69d2abc..f1f2756a 100644 --- a/internal/utils/service_linux.go +++ b/internal/utils/service_linux.go @@ -113,6 +113,12 @@ func (this *ServiceManager) installSystemdService(systemd, exePath string, args shortName := teaconst.SystemdServiceName longName := "GoEdge API" // TODO 将来可以修改 + var startCmd = exePath + " daemon" + bashPath, _ := executils.LookPath("bash") + if len(bashPath) > 0 { + startCmd = bashPath + " -c \"" + startCmd + "\"" + } + desc := `### BEGIN INIT INFO # Provides: ` + shortName + ` # Required-Start: $all @@ -131,7 +137,7 @@ After=network-online.target Type=simple Restart=always RestartSec=1s -ExecStart=` + exePath + ` daemon +ExecStart=` + startCmd + ` ExecStop=` + exePath + ` stop ExecReload=` + exePath + ` reload