From fc738e6f4efcd69eb4d693234b195ec48d391132 Mon Sep 17 00:00:00 2001 From: EnumDev Date: Thu, 11 Dec 2025 13:06:17 +0200 Subject: [PATCH] esvm: set service PID to 0 for simple services with a stop command --- src/esvm/service.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/esvm/service.go b/src/esvm/service.go index 4ab6bb1..2e7abe8 100644 --- a/src/esvm/service.go +++ b/src/esvm/service.go @@ -326,6 +326,12 @@ func (service *EnitService) StartService() (err error) { service.state = EnitServiceRunning + // Set PID to 0 for simple services with a stop command + if service.Type == "simple" && service.StopCmd != "" { + pid = 0 + service.processID = 0 + } + go func() { err := cmd.Wait() @@ -339,7 +345,9 @@ func (service *EnitService) StartService() (err error) { service.restartCount = 0 default: // Kill remaining child processes - syscall.Kill(-pid, syscall.SIGKILL) + if pid != 0 { + syscall.Kill(-pid, syscall.SIGKILL) + } if service.Type == "simple" && err == nil { service.restartCount = 0