diff --git a/StarAgent/MyStarClient.cs b/StarAgent/MyStarClient.cs index b1f34c7..5d86d2b 100644 --- a/StarAgent/MyStarClient.cs +++ b/StarAgent/MyStarClient.cs @@ -108,7 +108,6 @@ protected override void Restart(Upgrade upgrade) } else { - // 重新拉起进程 this.WriteInfoEvent("Upgrade", "强制更新完成,准备拉起新进程!PID=" + pid); // 重新拉起进程,重启服务,否则采取拉起进程的方式 diff --git a/StarAgent/Program.cs b/StarAgent/Program.cs index 7367a57..1048e2a 100644 --- a/StarAgent/Program.cs +++ b/StarAgent/Program.cs @@ -2,6 +2,7 @@ using System.Reflection; using NewLife; using NewLife.Agent; +using NewLife.Agent.Models; using NewLife.Log; using NewLife.Model; using NewLife.Reflection; @@ -14,6 +15,7 @@ using Stardust.Models; using Stardust.Plugins; using IHost = NewLife.Agent.IHost; +using ServiceModel = NewLife.Agent.Models.ServiceModel; namespace StarAgent; @@ -180,7 +182,16 @@ private void FixKillMode(SystemdSetting set) exe = dll; } - Host.Install(ServiceName, DisplayName, exe, "-s", Description); + var service = new ServiceModel + { + ServiceName = ServiceName, + DisplayName = DisplayName, + Description = Description, + FileName = exe, + Arguments = "-s", + }; + + Host.Install(service); } } }