Currently I have an application used to update my software, this is a standalone executable that’s only job is to perform software updates.
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 …
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?
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:
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.
then, Stub would launch CopyFiles and terminate itself.
CopyFiles could then update Stub if needed as well as all the main application files.
CopyFiles would then launch the main application executable.
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.