From f72902cd8dc3b3678c2acaf79a78b32618f30382 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=A5=E8=B6=85?= Date: Fri, 8 Mar 2024 19:00:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96systemd=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/utils/service_linux.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/internal/utils/service_linux.go b/internal/utils/service_linux.go index 03802c80..3cf370b8 100644 --- a/internal/utils/service_linux.go +++ b/internal/utils/service_linux.go @@ -112,6 +112,12 @@ func (this *ServiceManager) installSystemdService(systemd, exePath string, args shortName := teaconst.SystemdServiceName longName := "GoEdge Admin" // 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 @@ -130,7 +136,7 @@ After=network-online.target Type=simple Restart=always RestartSec=5s -ExecStart=` + exePath + ` daemon +ExecStart=` + startCmd + ` ExecStop=` + exePath + ` stop ExecReload=` + exePath + ` reload