From 26a6952091637fff640665d9b3980bf3e5d1a16d Mon Sep 17 00:00:00 2001 From: EnumDev Date: Wed, 3 Dec 2025 19:03:37 +0200 Subject: [PATCH] Remove redundant 'exit_method' field --- src/esvm/service.go | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/esvm/service.go b/src/esvm/service.go index cc8f458..d4dd216 100644 --- a/src/esvm/service.go +++ b/src/esvm/service.go @@ -44,7 +44,6 @@ type EnitService struct { Description string `yaml:"description,omitempty"` Type string `yaml:"type"` StartCmd string `yaml:"start_cmd"` - ExitMethod string `yaml:"exit_method"` CrashOnSafeExit bool `yaml:"crash_on_safe_exit"` StopCmd string `yaml:"stop_cmd,omitempty"` User string `yaml:"user,omitempty"` @@ -157,7 +156,6 @@ func LoadService(filepath string) { Description: "", Type: "", StartCmd: "", - ExitMethod: "", StopCmd: "", User: "", Restart: "", @@ -194,13 +192,6 @@ func LoadService(filepath string) { return } - switch newService.ExitMethod { - case "stop_command", "kill": - default: - logger.Printf("Error: unknown exit method (%s)\n", newService.ExitMethod) - return - } - switch newService.Restart { case "true", "always": default: @@ -352,7 +343,7 @@ func (service *EnitService) StartService() (err error) { if service.Type == "simple" && err == nil { service.restartCount = 0 - if service.ExitMethod != "stop_command" { + if strings.TrimSpace(service.StopCmd) == "" { service.state = EnitServiceCompleted // Reload service if needed @@ -428,7 +419,7 @@ func (service *EnitService) StopService() error { } }() - if service.ExitMethod == "kill" { + if strings.TrimSpace(service.StopCmd) == "" { if err := service.GetProcess().Signal(syscall.Signal(0)); err != nil { newServiceStatus = EnitServiceStopped logger.Printf("Service (%s) has stopped (Process already dead)", service.Name)