如何更新正在运行的服务? [英] How to update a running service?

查看:169
本文介绍了如何更新正在运行的服务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前我用来更新我的软件应用程序,这是一个独立的可执行文件,这只是工作就是执行软件更新。

Currently I have an application used to update my software, this is a standalone executable that's only job is to perform software updates.

当它被启动它会将自身复制从\Binary\到\Running\文件夹,然后执行本身\Running\来执行工作(因此在\Binary\副本被从未锁定或使用中),在该情况下它需要更新它本身只是更新执行它运行较新的副本\Binary\因此,下一次下副本,也没有问题。这个过程已经工作多年细...

When it is launched it copies itself from a \Binary\ to \Running\ folder and then executes itself in \Running\ to perform the work (so the copy in \Binary\ is never locked or in-use), in the case where it needs to update itself it simply updates the copy under \Binary\ so next time it is run the newer copy is executed and there is no issues. This process has worked fine for years ...

现在我需要做出改变,我需要这个过程转移到一个服务(因此它可以执行软件的更新本地系统它拥有管理员权限) - 我可以使用相同的模式?可以在服务,在启动时,自己从\Binary\在任何时候都复制到\Running\并运行\Running\文件夹?

Now I need to make a change, I need to move this process to a SERVICE (so it can perform software updates as LocalSystem where it has Admin rights) - can I use the same model? Can a service, when it starts, copy itself from \Binary\ to \Running\ and run from the \Running\ folder at all times?

否则,我怎么可以更新Service.exe?任何建议

Otherwise, any suggestions on how I could update Service.exe?

任何意见,帮助,建议将不胜感激。
谢谢,

Any advice, help, suggestions would be greatly appreciated. Thanks,

推荐答案

在过去的一个项目,我们使用了两个阶段的更新:

On a project in the past, we used a two-phase update:


  • 第一,被称为存根一个非常非常小的简单的程序会检查是否有更新的实际更新(称为CopyFiles)。如果CopyFiles在服务器上更新,它会被复制下来。

  • first, a very very small simple program called Stub would check for updates to the actual updater (called CopyFiles). If CopyFiles was newer on the server, it would get copied down.

然后,存根将推出CopyFiles并终止本身。

then, Stub would launch CopyFiles and terminate itself.

CopyFiles如果需要,以及所有主要的应用程序文件可能会再更新存根。

CopyFiles could then update Stub if needed as well as all the main application files.

CopyFiles将然后启动主应用程序的可执行

CopyFiles would then launch the main application executable.

有关您的情况,我可以预见两个服务运行 - 其中一个是实际的应用程序而另一种监视您的\Binary文件夹。这项服务,有管理员权限,可以关闭实际应用服务,复制更新\Running,然后启动应用程序服务再试一次。

For your scenario, I can forsee two services running - one which is your actual application and another which monitors your \Binary folder. That service, having Admin rights, can shut down the actual application service, copy the updates to \Running and then start the app service back up again.

这篇关于如何更新正在运行的服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆