From 4403ba2925bc1c063c1887b5e8e9e2245629d3aa Mon Sep 17 00:00:00 2001 From: kongfei605 Date: Wed, 10 Dec 2025 17:19:18 +0800 Subject: [PATCH] feat(systemd): add WantedBy option with default multi-user.target --- service.go | 3 +++ service_systemd_linux.go | 2 ++ 2 files changed, 5 insertions(+) diff --git a/service.go b/service.go index 130fc22..0577eda 100644 --- a/service.go +++ b/service.go @@ -97,6 +97,9 @@ const ( optionOpenRCScript = "OpenRCScript" optionLogDirectory = "LogDirectory" + + optionWantedBy = "WantedBy" + optionWantedByDefault = "multi-user.target" ) // Status represents service status as an byte value diff --git a/service_systemd_linux.go b/service_systemd_linux.go index 6c21f29..ae22421 100644 --- a/service_systemd_linux.go +++ b/service_systemd_linux.go @@ -175,6 +175,7 @@ func (s *systemd) Install() error { SuccessExitStatus string LogOutput bool LogDirectory string + WantedBy string }{ s.Config, path, @@ -186,6 +187,7 @@ func (s *systemd) Install() error { s.Option.string(optionSuccessExitStatus, ""), s.Option.bool(optionLogOutput, optionLogOutputDefault), s.Option.string(optionLogDirectory, defaultLogDirectory), + s.Option.string(optionWantedBy, optionWantedByDefault), } err = s.template().Execute(f, to)